I've renamed column in my database (from configuration_SYSTEM_ID to SYSTEM_ID), and added AttributeOverride annotation to my AbstractSubConfiguration class. But hibernate ignore this annotation and continue generate queries with old column names (configuration_SYSTEM_ID instead of SYSTEM_ID).
My classes looks like this:
AbstractSubConfiguration.java
#MappedSuperclass
#IdClass(Configuration.class)
public class AbstractSubConfiguration implements Dto, Serializable {
private static final long serialVersionUID = -6271877313478924753L;
#Id
#OneToOne(fetch = FetchType.LAZY)
#AttributeOverride(name = "systemId", column = #Column(name = "SYSTEM_ID"))
private Configuration configuration;
public AbstractSubConfiguration() {
super();
}
public AbstractSubConfiguration(final Configuration configuration) {
super();
this.configuration = configuration;
}
#XmlTransient
public final Configuration getConfiguration() {
return configuration;
}
public final void setConfiguration(final Configuration configuration) {
this.configuration = configuration;
}
}
Configuration.java
Entity(name = "CONFIGURATION")
public class Configuration implements Dto, Serializable {
private static final long serialVersionUID = 6601197795258837065L;
#EmbeddedId
private ConfigurationId configurationId;
#Column(name = "CONFIGURATION_NAME")
private String configurationName;
#OneToOne(cascade = CascadeType.PERSIST, mappedBy = "configuration", fetch = FetchType.EAGER)
private BasicConfiguration basicConfiguration;
#OneToOne(cascade = CascadeType.PERSIST, mappedBy = "configuration", fetch = FetchType.EAGER)
private AdvancedConfiguration advancedConfiguration;
.....
...
}
ConfigurationId.java
#Embeddable
public class ConfigurationId implements Serializable {
private static final long serialVersionUID = -5123943430808049180L;
private SystemId systemId;
#Column(name = "CONFIGURATION_ID")
private int configurationId;
public ConfigurationId(final SystemId systemId, final int configurationId) {
super();
this.systemId = systemId;
this.configurationId = configurationId;
}
....
....
}
And as a result I have an error 2695 [main] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Unknown column 'tes0_.configuration_SYSTEM_ID' in 'field list'
From doc #AttributeOverride
java.lang.String name
(Required) The name of the property whose mapping is being overridden if property-based access is being used, or the name of the
field if field-based access is used.
In your mapping I don't see systemId property instead I see configurationId property
Edit
Accordance your editing name in #AttributeOverride should be configuration.systemId
See example from java doc with zipcode:
#Embeddable public class Address {
protected String street;
protected String city;
protected String state;
#Embedded protected Zipcode zipcode;
}
#Embeddable public class Zipcode {
protected String zip;
protected String plusFour;
}
#Entity public class Customer {
#Id protected Integer id;
protected String name;
#AttributeOverrides({
#AttributeOverride(name="state",
column=#Column(name="ADDR_STATE")),
#AttributeOverride(name="zipcode.zip",
column=#Column(name="ADDR_ZIP"))
})
#Embedded protected Address address;
...
}
Resolved it in this way:
#MappedSuperclass
#IdClass(Configuration.class)
public class AbstractSubConfiguration implements Dto, Serializable {
private static final long serialVersionUID = -6271877313478924753L;
#Id
#OneToOne(fetch = FetchType.LAZY)
#JoinColumns({
#JoinColumn(name = "SYSTEM_ID", referencedColumnName = "SYSTEM_ID"),
#JoinColumn(name = "configuration_CONFIGURATION_ID", referencedColumnName = "CONFIGURATION_ID")})
private Configuration configuration;
...
....
}
Related
Does the #Embeddable for #ManyToMany relations and additional columns, works with String?
I do not use #Generated Value for #Id
Because my Entity ApplikationUser
#Id
#Column(length = 128)
private String applikationUserId;
by business logic has always an Id
Here my code:
#EmbeddedId
private ApplikationUserPopupMessageId applikationUserPopupMessageId;
#ManyToOne(fetch = FetchType.EAGER)
#MapsId("applikationUserId")
private ApplikationUser applikationUser;
#ManyToOne(fetch = FetchType.EAGER)
#MapsId("popupMessageId")
private PopupMessage popupMessage;
#Column(name = "gelesen")
private boolean gelesen = false;
#Embeddable
public class ApplikationUserPopupMessageId implements Serializable {
#Column(name = "applikation_user_id")
private String applikationUserId;
#Column(name = "popup_message_id")
private Long popupMessageId;
#Entity
#Table
public class PopupMessage {
#Id
#GeneratedValue
#Column(length = 128)
private Long messageId;
private String title;
private String message;
#OneToMany(
mappedBy = "applikationUser",
cascade = CascadeType.ALL,
orphanRemoval = true
)
private List<ApplikationUserPopupMessage> applikationUserPopupMessages = new ArrayList<>();
#Entity
public class ApplikationUser implements UserDetails {
/**
*
*/
private static final long serialVersionUID = -5517804528054972083L;
#Id
#Column(length = 128)
private String applikationUserId;
#Column
private String password;
#ManyToOne
#JoinColumn(name = "idRole")
private Role role;
private boolean enabled = true;
#OneToMany(
mappedBy = "popupMessage",
cascade = CascadeType.ALL,
orphanRemoval = true
)
private List<ApplikationUserPopupMessage> applikationUserPopupMessages = new ArrayList<>();
EDIT - 23.11.2020
Regards the lack of interest, its seems to be possible to us #Embeddable with String?
Instantiate applikationUserPopupMessageId:
#Entity
public class ApplikationUserPopupMessage {
#EmbeddedId
private ApplikationUserPopupMessageId applikationUserPopupMessageId = new ApplikationUserPopupMessageId();
}
That's known issue
Just put getters and setters for the according properties in your #Embeddable.
Does it help if you annotate your entity class with Access level to Field
#Entity(access = AccessType.FIELD)
I have an entity CpoPipeline with a relationship ManyToOne with CpoEnvironment:
#Entity
#Table(name = "cpo_pipeline", catalog = "cup_orchestrator")
public class CpoPipeline implements java.io.Serializable {
private String pipelineId;
private String pipelineName;
private CpoEnvironment cpoEnvironment;
#Column(name = "pipeline_id", unique = true, nullable = false)
public String getPipelineId() {
return this.pipelineId;
}
#ManyToOne(fetch = FetchType.EAGER)
#JoinColumn(name = "environment_id", nullable = false)
public CpoEnvironment getCpoEnvironment() {
return this.cpoEnvironment;
}
//Getters and Setters
}
The entity CpoEnvironment:
#Entity
#Table(name = "cpo_environment", catalog = "cup_orchestrator")
public class CpoEnvironment implements java.io.Serializable {
private String environmentId;
private String environment;
private Set<CpoPipeline> cpoPipelines = new HashSet<CpoPipeline>(0);
#Id
#Column(name = "environment_id", unique = true, nullable = false)
public String getEnvironmentId() {
return this.environmentId;
}
#OneToMany(fetch = FetchType.LAZY, mappedBy = "cpoEnvironment")
public Set<CpoPipeline> getCpoPipelines() {
return this.cpoPipelines;
}
//Getters and Setters
}
The repository for this entity with a method name:
#Repository
public interface PipelineRep extends JpaRepository<CpoPipeline, String> {
Optional<CpoPipeline> findByPipelineIdAndEnvironmentId(String pipelineId, String environmentId);
}
Error: Caused by: org.springframework.data.mapping.PropertyReferenceException: No property environmentId found for type CpoPipeline
How can I create a method name using one field from the entity and one field from the relation? Is it possible?
Yes possible, to use environmentId of CpoEnvironment entity use this way CpoEnvironmentEnvironmentId
Optional<CpoPipeline> findByPipelineIdAndCpoEnvironmentEnvironmentId(String pipelineId, String environmentId);
I have two tables with primary keys questionNumber and assessmentId. I want to use these two to make them composite in two different tables. Is this possible. Should I add something to this to make it work. OR is there another way to implement it. OR should I add question meta data to question and just used the composite key in AnswerKey
Question
#Entity
#Getter
#Setter
public class Question implements Serializable {
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private int questionId;
private int questionNumber;
private String assessmentId;
private QuestionTypes questionType;
private String questionText;
private String questionURL;
private QuestionStatus questionStatus;
#OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
#JoinColumn(name = "questionNumber", referencedColumnName = "questionNumber")
private List<QuestionOption> questionOptions;
//Constructor
// Getter and setter
}
Assessment
#Entity
#JsonIgnoreProperties({"questionList"})
public class Assessment {
#Id
private String assessmentId;
private String assessmentTopic;
private String assessmentSubTopic;
private String assessmentLevel;
private String createdBy;
private String rating;
#OneToMany(cascade = CascadeType.ALL, mappedBy = "assessmentId", fetch = FetchType.LAZY)
private List<Question> questionList;
//Constructor
//Setter and getter
}
QuestionMetaData
#Entity
public class QuestionMetaData {
#Id
private QuestionAssessmentKey questionAssessmentKey;
private String topicName;
private String subtopicName;
private QuestionComplexity complexity;
private String conceptName;
//Getter and setter
//Constructor
}
AnswerKey
#Entity
public class AnswerKey {
#Id
private QuestionAssessmentKey questionAssessmentKey;
private Character answer;
//Constructor
// Setter and getter
}
Key
#Embeddable
public class QuestionAssessmentKey implements Serializable {
private int questionNumber;
private String assessmentId;
//Constructor
//Setter and Getter
}
These are "derived identities", so your mappings should like this:
#Entity
public class Assessment {
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private String assessmentId;
private String assessmentTopic;
private String assessmentSubTopic;
private String assessmentLevel;
private String createdBy;
private String rating;
#OneToMany(cascade = CascadeType.ALL, mappedBy = "assessment", fetch = FetchType.LAZY)
private List<Question> questionList;
// ...
}
#Entity
public class Question implements Serializable {
#EmbeddedId
private QuestionAssessmentKey questionAssessmentKey;
#ManyToOne
#MapsId("assessmentId") // maps assessmentId attribute of embedded id
private Assessment assessment;
private QuestionTypes questionType;
private String questionText;
private String questionURL;
private QuestionStatus questionStatus;
#OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
#JoinColumn(name = "questionNumber", referencedColumnName = "questionNumber")
private List<QuestionOption> questionOptions;
// ...
}
#Entity
public class QuestionMetaData {
#EmbeddedId
private QuestionAssessmentKey questionAssessmentKey;
private String topicName;
private String subtopicName;
private QuestionComplexity complexity;
private String conceptName;
#ManyToOne
#MapsId("assessmentId") // maps assessmentId attribute of embedded id
private Assessment assessment;
// ...
}
#Entity
public class AnswerKey {
#EmbeddedId
private QuestionAssessmentKey questionAssessmentKey;
private Character answer;
#ManyToOne
#MapsId("assessmentId") // maps assessmentId attribute of embedded id
private Assessment assessment;
// ...
}
#Embeddable
public class QuestionAssessmentKey implements Serializable {
private String assessmentId;
private int questionNumber;
// ...
}
I have configured composite primary key for my entity Employee as follows
Employee.java:
#Entity
#Table(name="employee")
#Proxy(lazy=false)
#IdClass(EmployeeId.class)
public class Employee implements Serializable {
private static final long serialVersionUID = 1L;
private EmployeeId employeeId;
private Person person;
private Branch branch;
private boolean isActive;
public Employee() {
}
#EmbeddedId
#AttributeOverrides({
#AttributeOverride(name="person", column = #Column(name="person_id")),
#AttributeOverride(name="branch", column = #Column(name="branch_id"))})
public EmployeeId getEmployeeId() {
return employeeId;
}
public void setEmployeeId(EmployeeId employeeId) {
this.employeeId = employeeId;
}
#ManyToOne(fetch=FetchType.LAZY)
#JoinColumn(name="person_id")
public Person getPerson() {
return person;
}
public void setPerson(Person person) {
this.person = person;
}
#ManyToOne(fetch=FetchType.LAZY)
#JoinColumn(name="branch_id")
public Branch getBranch() {
return branch;
}
public void setBranch(Branch branch) {
this.branch = branch;
}
#Column(name="is_active")
public boolean getIsActive() {
return isActive;
}
public void setIsActive(boolean isActive) {
this.isActive = isActive;
}
}
EmployeeId.java:
#Embeddable
public class EmployeeId implements Serializable {
private static final long serialVersionUID = 1L;
private Person person;
private Branch branch;
public EmployeeId() {
}
public EmployeeId(Person argPerson, Branch argbranch) {
this.person = argPerson;
this.branch = argbranch;
}
#ManyToOne(fetch=FetchType.LAZY)
#JoinColumn(name="person_id", insertable=false, updatable=false)
public Person getPerson() {
return person;
}
public void setPerson(Person person) {
this.person = person;
}
#ManyToOne(fetch=FetchType.LAZY)
#JoinColumn(name="branch_id", insertable=false, updatable=false)
public Branch getBranch() {
return branch;
}
public void setBranch(Branch branch) {
this.branch = branch;
}
}
I created a SessionFactory bean using class org.springframework.orm.hibernate5.LocalSessionFactoryBean and mapped all hbm.xml as a MappingLocations.
My code throws the following error:
Caused by: java.lang.IllegalArgumentException: expecting IdClass mapping
at org.hibernate.metamodel.internal.AttributeFactory$3.resolveMember(AttributeFactory.java:971)
at org.hibernate.metamodel.internal.AttributeFactory$5.resolveMember(AttributeFactory.java:1029)
at org.hibernate.metamodel.internal.AttributeFactory.determineAttributeMetadata(AttributeFactory.java:451)
at org.hibernate.metamodel.internal.AttributeFactory.buildIdAttribute(AttributeFactory.java:128)
at org.hibernate.metamodel.internal.MetadataContext.buildIdClassAttributes(MetadataContext.java:337)
at org.hibernate.metamodel.internal.MetadataContext.applyIdMetadata(MetadataContext.java:269)
at org.hibernate.metamodel.internal.MetadataContext.wrapUp(MetadataContext.java:190)
at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:219)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:296)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:476)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:707)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:723)
at org.springframework.orm.hibernate5.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:504)
at org.springframework.orm.hibernate5.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:488)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFac
How can I avoid this error? I am using spring-orm-4.3.1-RELEASE and hibernate-core-5.2.0.Final.
Update
I have created a sample project and I am getting the following error while running...
Caused by: org.hibernate.AnnotationException: Property of #IdClass not found in entity sample.domain.Employee: employee
Refer the code: https://www.dropbox.com/s/axr8l01iqh0qr29/idclass-using-hibernate5.tar.gz?dl=0
What I did wrong? Kindly provide your inputs here
Your situation corresponds to the chapter 2.4.1 Primary Keys Corresponding to Derived Identities of the JPA 2.1 Specification.
The identity of Employee is derived from identities of Person and Branch. You haven't shown the code of either of them, so I'll assume they have simple primary keys. In that relationship, Person and Branch are "parent entities" and Employee is a "dependant" entity.
The ID of Employee may be mapped using either IdClass or EmbeddedId, not both at the same time.
See chapter 2.4.1.1 Specification of Derived Identities.
If you want to use IdClass, then:
The names of the attributes of the id class and the Id attributes of the dependent entity class must correspond as follows:
The Id attribute in the entity class and the corresponding attribute in the id class must have the same name.
...
If an Id attribute in the entity is a many-to-one or one-to-one relationship to a parent entity, the corresponding attribute in the id class must be of (...) the type of the Id attribute of the parent entity.
So your classes would look like this (getters, setters, superfluous annotations etc. omitted)
#Entity
#IdClass(EmployeeId.class)
public class Employee {
#Id
#ManyToOne
private Person person;
#Id
#ManyToOne
private Branch branch;
}
public class EmployeeId {
private Long person; // Corresponds to the type of Person ID, name matches the name of Employee.person
private Long branch; // Corresponds to the type of Branch ID, name matches the name of Employee.branch
}
If you use EmbeddedId, then:
If the dependent entity uses an embedded id to represent its primary key, the attribute in the embedded id corresponding to the relationship attribute must be of the same type as the primary key of the parent entity and must be designated by the MapsId annotation applied to the relationship attribute. The value element of the MapsId annotation must be used to specify the name of the attribute within the embedded id to which the relationship attribute corresponds.
And the code would look like this:
#Entity
public class Employee {
#EmbeddedId
private EmployeeId id;
#ManyToOne
#MapsId("personId") // Corresponds to the name of EmployeeId.personId
private Person person;
#ManyToOne
#MapsId("branchId") // Corresponds to the name of EmployeeId.branchId
private Branch branch;
}
#Embeddable
public class EmployeeId {
private Long personId; // Corresponds to the type of Person ID
private Long branchId; // Corresponds to the type of Branch ID
}
A composite key mapping can be either done with an IdClass or an Embeddable. If you want to use an IdClass you have to annotate your fields in Employee with #Id.
#IdClass(EmployeeId.class)
class Person{
#Id
private Person person;
#Id
private Branch branch;
}
If you want to use an Embedded as a composite key please remove the #IdClass(EmployeeId.class) annotation from Person. You also don't need the person and branch field in your Person class because those are defined in your Embedded class.
Change to:
#Entity
#Table(name = "employee")
#Proxy(lazy = false)
#IdClass(EmployeeId.class)
public class Employee implements Serializable {
private static final long serialVersionUID = 1L;
private EmployeeId id;
private Person person;
private Branch branch;
private boolean isActive;
public Employee() {
}
#EmbeddedId
#AttributeOverrides({#AttributeOverride(name = "person", column = #Column(name = "person_id") ),
#AttributeOverride(name = "branch", column = #Column(name = "branch_id") )})
public EmployeeId getId() {
return id;
}
public void setId(EmployeeId id) {
this.id = id;
}
#ManyToOne(fetch = FetchType.LAZY)
#JoinColumn(name = "person_id")
public Person getPerson() {
return person;
}
public void setPerson(Person person) {
this.person = person;
}
#ManyToOne(fetch = FetchType.LAZY)
#JoinColumn(name = "branch_id")
public Branch getBranch() {
return branch;
}
public void setBranch(Branch branch) {
this.branch = branch;
}
#Column(name = "is_active")
public boolean getIsActive() {
return isActive;
}
public void setIsActive(boolean isActive) {
this.isActive = isActive;
}
}
The IdClass shouldnt be defined as Embeddable -
#Entity
#Table(name="employee")
#IdClass(EmployeeId.class)
public class Employee implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#ManyToOne
private Person person;
#Id
#ManyToOne
private Branch branch;
private boolean isActive;
public Employee() { }
//....
}
And -
public class EmployeeId implements Serializable {
private static final long serialVersionUID = 1L;
private Person person;
private Branch branch;
public EmployeeId() {}
public EmployeeId(Person argPerson, Branch argbranch) {
this.person = argPerson;
this.branch = argbranch;
}
}
Read your comment - Can I make a suggestion that you map Employee to person_id and branch_id, and not the JPA objects Person and Branch? This will let us test if your hbm config is correct. Id also suggest posting your hbm config as I think there is information missing from this problem
So the table will be similar to -
#Entity
#Table(name="employee")
#IdClass(EmployeeId.class)
public class Employee implements Serializable {
private static final long serialVersionUID = 1L;
#Id
private Long personId;
#Id
private Long branchId;
private boolean isActive;
public Employee() { }
//....
}
And -
And -
public class EmployeeId implements Serializable {
private static final long serialVersionUID = 1L;
private Long personId;
private Long branchId;
public EmployeeId() {}
public EmployeeId(Person argPerson, Branch argbranch) {
this.person = argPerson;
this.branch = argbranch;
}
}
This link could help you
JPA - EmbeddedId with #ManytoOne
Relationship mappings defined within an embedded id class are not supported.Then you need to change the embeddedId class like this
#Embeddable
public class EmployeeId implements Serializable {
private static final long serialVersionUID = 1L;
private Long personId;
private Long branchId;
public EmployeeId() {
}
public EmployeeId(Long argPerson, Long argbranch) {
this.personId = argPerson;
this.branchId = argbranch;
}
#Column(name = "person_id")
public Long getPersonId() {
return personId;
}
public void setPersonId(Long personId) {
this.personId = personId;
}
#Column(name = "branch_id")
public Long getBranchId() {
return branchId;
}
public void setBranchId(Long branchId) {
this.branchId = branchId;
}
}
JPA Composite Primary Key
Specifies a composite primary key class that is mapped to multiple fields or properties of the entity.
The names of the fields or properties in the primary key class and the
primary key fields or properties of the entity must correspond and
their types must be the same.
The answer is in here. read description for you. enter link description here
(Sample code)
#Entity
#Table(name = "EMP_PROJECT")
#IdClass(ProjectAssignmentId.class)
public class ProjectAssignment {
#Id
#Column(name = "EMP_ID", insertable = false, updatable = false)
private int empId;
#Id
#Column(name = "PROJECT_ID", insertable = false, updatable = false)
private int projectId;
#ManyToOne
#JoinColumn(name = "EMP_ID")
Professor employee;
#ManyToOne
#JoinColumn(name = "PROJECT_ID")
Project project;
....
}
public class ProjectAssignmentId implements Serializable {
private int empId;
private int projectId;
...
}
Mention #IdClass annotation with the class which holds the ID.
Check the answer at this post
I'm building a small eclipse rcp with a little bit of JPA. Now something strange happens:
I create some TopCategories with some SubCategories, this works as intended. The inserts are printed in the log. I close my application and now the problem raises up:
The Categories have a relation to books
Book.java
#Entity
public class Book implements Serializable, PropertyChangeListener {
private static final long serialVersionUID = 4646743297687986216L;
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String name;
private boolean active = true;
#Temporal(TemporalType.TIMESTAMP)
private Date updated;
#Lob
private Set<Group> allowedGroups;
#Column(columnDefinition = "TEXT")
private String text;
private BookType type;
#ManyToOne
private TopCategory topCategory;
#ManyToOne
private SubCategory subCategory;
#OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private BookAttachment attachment;
#Transient
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
// ordinary getter/setter
#PrePersist
#PreUpdate
private void updateUpdated() {
this.updated = new Date();
}
}
After restart and querying Book with this select b from Book all SubCategories which aren't used getting deleted. If a SubCategory has a relation to Book it stays in my DB. Why this occures?
Category.java
#MappedSuperclass
public class Category implements Serializable {
private static final long serialVersionUID = 6091963773161164543L;
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String name;
#Temporal(TemporalType.TIMESTAMP)
private Date updated;
#Enumerated(EnumType.STRING)
private CategoryType type;
#Transient
private List<Snippet> snippets = new LinkedList<Snippet>();
// ordinary getter/setter
#PrePersist
#PreUpdate
public void updateUpdated() {
this.updated = new Date();
}
}
TopCategory.java
#Entity
public class TopCategory extends Category {
#OneToMany(cascade = CascadeType.ALL)
private List<SubCategory> subCategories;
public TopCategory() {
setName("");
setSubCategories(new ArrayList<SubCategory>());
}
public List<SubCategory> getSubCategories() {
return subCategories;
}
public void setSubCategories(List<SubCategory> subCategories) {
this.subCategories = subCategories;
}
#Override
public void setType(CategoryType type) {
super.setType(CategoryType.topCategory);
}
SubCategory.java
#Entity
public class SubCategory extends Category {
#ManyToOne(cascade = CascadeType.ALL)
private TopCategory topCategory;
public TopCategory getTopCategory() {
return topCategory;
}
public void setTopCategory(TopCategory topCategory) {
this.topCategory = topCategory;
}
#Override
public void setType(CategoryType type) {
super.setType(CategoryType.subCategory);
}
}
I'm using Eclipselink 2.1.1.
Regards
Alright - I've found the problem: One of the result lists from my model is modified from a contentprovider - this is were not used SubCategories are removed, in case that the entity objects weren't detached, it caused the entitymanger to update.