Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6746047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:16:37+00:00 2026-05-26T12:16:37+00:00

I got the above error though i have set the ID manually, Im not

  • 0

I got the above error though i have set the ID manually, Im not using auto generated key here.
when i set the key and pass the object to

entityManager.persist(obj);

it gives the above error.
any help… plz

thanks

This is the InstallationInfo class, and I got the above error when persisting the installationInfo object. The complete error is

org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): se.cambio.cimonitor.jpa.table.ModuleInfo

so I have attached the ModuleInfo class as well

package se.cambio.cimonitor.jpa.table;

@Entity
@Table(name = "InstallationInfo", catalog="CI_Monitor", schema="dbo")
public class InstallationInfo implements java.io.Serializable {

/**
 * 
 */
private static final long serialVersionUID = 1L;
private String installationId;
private String timestamp;
private Module moduleByParentId;
private Environment environmentByEnvironmentClientId;
private Environment environmentByEnvironmentServerId;
private Module moduleByBaseLineId;
private String machineName;
private String status;
private String teamName;
private Set<ModuleInfo> moduleInfos = new HashSet<ModuleInfo>(0);

public InstallationInfo() {
}

public InstallationInfo(String installationId) {
    this.installationId = installationId;
}

public InstallationInfo(String installationId,
        Module moduleByParentId,
        Environment environmentByEnvironmentClientId,
        Environment environmentByEnvironmentServerId,
        Module moduleByBaseLineId, String machineName,
        String status, String teamName,
        Set<ModuleInfo> moduleInfos) {
    this.installationId = installationId;
    this.moduleByParentId = moduleByParentId;
    this.environmentByEnvironmentClientId = environmentByEnvironmentClientId;
    this.environmentByEnvironmentServerId = environmentByEnvironmentServerId;
    this.moduleByBaseLineId = moduleByBaseLineId;
    this.machineName = machineName;
    this.status = status;
    this.teamName = teamName;
    this.moduleInfos = moduleInfos;
}

/*@TableGenerator(name="InstlIds", table="InstlPkTb", pkColumnName="InstlId", pkColumnValue="InstlIdVal", allocationSize=1, catalog="CI_Monitor", schema="dbo")
@GeneratedValue(strategy=GenerationType.TABLE, generator="InstlIds")*/
@Id
@Column(name = "InstallationId", unique = true, nullable = false, insertable = true, updatable = true)
public String getInstallationId() {
    return this.installationId;
}

public void setInstallationId(String installationId) {
    this.installationId = installationId;
}

//@Version This is a bug
@Column(name = "Timestamp")
public String getTimestamp() {
    return this.timestamp;
}

public void setTimestamp(String timestamp) {
    this.timestamp = timestamp;
}

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "ParentId")
public Module getModuleByParentId() {
    return this.moduleByParentId;
}

public void setModuleByParentId(Module moduleByParentId) {
    this.moduleByParentId = moduleByParentId;
}

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "EnvironmentClientId")
public Environment getEnvironmentByEnvironmentClientId() {
    return this.environmentByEnvironmentClientId;
}

public void setEnvironmentByEnvironmentClientId(
        Environment environmentByEnvironmentClientId) {
    this.environmentByEnvironmentClientId = environmentByEnvironmentClientId;
}

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "EnvironmentServerId")
public Environment getEnvironmentByEnvironmentServerId() {
    return this.environmentByEnvironmentServerId;
}

public void setEnvironmentByEnvironmentServerId(
        Environment environmentByEnvironmentServerId) {
    this.environmentByEnvironmentServerId = environmentByEnvironmentServerId;
}

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "BaseLineId")
public Module getModuleByBaseLineId() {
    return this.moduleByBaseLineId;
}

public void setModuleByBaseLineId(Module moduleByBaseLineId) {
    this.moduleByBaseLineId = moduleByBaseLineId;
}

@Column(name = "MachineName")
public String getMachineName() {
    return this.machineName;
}

public void setMachineName(String machineName) {
    this.machineName = machineName;
}

@Column(name = "Status")
public String getStatus() {
    return this.status;
}

public void setStatus(String status) {
    this.status = status;
}

@Column(name = "TeamName")
public String getTeamName() {
    return teamName;
}

public void setTeamName(String teamName) {
    this.teamName = teamName;
}

@OneToMany(fetch = FetchType.EAGER, mappedBy = "installationInfo", targetEntity=ModuleInfo.class, cascade={CascadeType.ALL})    //targerEntity is added by Isuru
public Set<ModuleInfo> getModuleInfos() {
    return this.moduleInfos;
}

public void setModuleInfos(Set<ModuleInfo> moduleInfos) {
    this.moduleInfos = moduleInfos;
}

}

package se.cambio.cimonitor.jpa.table;

@Entity
@Table(name = "ModuleInfo", catalog="CI_Monitor", schema="dbo")
public class ModuleInfo implements java.io.Serializable {

/**
 * 
 */
private static final long serialVersionUID = 1L;
private ModuleInfoId id;
private InstallationInfo installationInfo;
private Module moduleByModuleId;
private Module moduleByParentId;
private Module moduleByBaseLineId;
private String buildNo;
private String svnRevision;

public ModuleInfo() {
}

public ModuleInfo(ModuleInfoId id, InstallationInfo installationInfo,
        Module moduleByModuleId) {
    this.id = id;
    this.installationInfo = installationInfo;
    this.moduleByModuleId = moduleByModuleId;
}

public ModuleInfo(ModuleInfoId id, InstallationInfo installationInfo,
        Module moduleByModuleId, Module moduleByParentId,
        Module moduleByBaseLineId, String buildNo,
        String svnRevision) {
    this.id = id;
    this.installationInfo = installationInfo;
    this.moduleByModuleId = moduleByModuleId;
    this.moduleByParentId = moduleByParentId;
    this.moduleByBaseLineId = moduleByBaseLineId;
    this.buildNo = buildNo;
    this.svnRevision = svnRevision;
}

@EmbeddedId
@AttributeOverrides({
        @AttributeOverride(name = "moduleId", column = @Column(name = "ModuleId", nullable = false)),
        @AttributeOverride(name = "installationId", column = @Column(name = "InstallationId", nullable = false)) })
public ModuleInfoId getId() {
    return this.id;
}

public void setId(ModuleInfoId id) {
    this.id = id;
}

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "InstallationId", nullable = false, insertable = false, updatable = false, unique = true)
public InstallationInfo getInstallationInfo() {
    return this.installationInfo;
}

public void setInstallationInfo(InstallationInfo installationInfo) {
    this.installationInfo = installationInfo;
}

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "ModuleId", nullable = false, insertable = false, updatable = false)
public Module getModuleByModuleId() {
    return this.moduleByModuleId;
}

public void setModuleByModuleId(Module moduleByModuleId) {
    this.moduleByModuleId = moduleByModuleId;
}

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "ParentId")
public Module getModuleByParentId() {
    return this.moduleByParentId;
}

public void setModuleByParentId(Module moduleByParentId) {
    this.moduleByParentId = moduleByParentId;
}

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "BaseLineId")
public Module getModuleByBaseLineId() {
    return this.moduleByBaseLineId;
}

public void setModuleByBaseLineId(Module moduleByBaseLineId) {
    this.moduleByBaseLineId = moduleByBaseLineId;
}

@Column(name = "BuildNo")
public String getBuildNo() {
    return this.buildNo;
}

public void setBuildNo(String buildNo) {
    this.buildNo = buildNo;
}

@Column(name = "SvnRevision")
public String getSvnRevision() {
    return this.svnRevision;
}

public void setSvnRevision(String svnRevision) {
    this.svnRevision = svnRevision;
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:16:38+00:00Added an answer on May 26, 2026 at 12:16 pm

    You have a cascade all on ModuleInfos collection, so when you save InstallationInfo it will try to save all the associated ModuleInfos. You need to make sure that the ids of the ModuleInfos are set before saving the InstallationInfo object.

    @OneToMany(fetch = FetchType.EAGER, mappedBy = "installationInfo", 
       targetEntity=ModuleInfo.class, cascade={CascadeType.ALL})    //targerEntity is added by Isuru
    public Set<ModuleInfo> getModuleInfos() {
        return this.moduleInfos;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got an unusual build error when using Buildroot to create an image for
I've got a similar problem to this post here: gitolite push error -> remote:
Error: Cannot convert type 'string' to 'object[*,*]' That's the error I have been getting.
I've just got an error message that was somewhat unexpected: Error Message: Could not
Somehow my FireFox 2 got corrupted, and the status bar is about 3/4 above
Got myself in a bit of a pickle here ... working on a CMS
Got a bit of a mind freeze at the moment. I have the following
Got some code that is not mine and its producing this warning atm: iehtmlwin.cpp(264)
I have a Java servlet running on my notebook with Windows Vista, I set
I have an action class that generates a PDF. The contentType is set appropriately.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.