Fields marked as @Transient on components that are mapped on @CollecionOfElements are
still persistent
------------------------------------------------------------------------------------------------------
Key: HHH-3678
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3678
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.2.6
Environment: Hibernate 3.2.6.GA, hibernate-commons-annotations 3.3.0.GA,
hibernate-annotations 3.3.0.GA.
Reporter: Leandro Feres Ribeiro
Attachments: testCase.zip
The test cases show the bug. I have a Component class, that is an attribute of the
CollectionElement class, that is mapped as a @CollectionOfElements on TestEntity.
Component has 4 transient attributes (name, description, middleName and lastName), however
only middleName and lastName behave as transient. This means that when the @Transient
annotation appears on the getter methods, on the Component class, it is not working.
See the classes below:
public class Component implements Serializable {
private Integer id;
private String name;
private String description;
@Transient
private String middleName;
private transient String lastName;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Transient
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Transient
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getMiddleName() {
return middleName;
}
public void setMiddleName(String middleName) {
this.middleName = middleName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
public class CollectionElement implements Serializable {
private Component component;
private Integer number;
private String property;
public Component getComponent() {
return component;
}
public void setComponent(Component component) {
this.component = component;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public String getProperty() {
return property;
}
public void setProperty(String property) {
this.property = property;
}
}
@Entity
@Table
public class TestEntity {
private Integer id;
private List<CollectionElement> elements = new
ArrayList<CollectionElement>();
@Id
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@CollectionOfElements
public List<CollectionElement> getElements() {
return elements;
}
public void setElements(List<CollectionElement> elements) {
this.elements = elements;
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira