[hibernate-issues] [Hibernate-JIRA] Created: (ANN-531) EntityMode.DOM4J does not deserialize collection entities

Laurent Perez (JIRA) noreply at atlassian.com
Mon Jan 15 09:04:44 EST 2007


EntityMode.DOM4J does not deserialize collection entities
---------------------------------------------------------

         Key: ANN-531
         URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-531
     Project: Hibernate Annotations
        Type: Bug

  Components: binder  
    Versions: 3.2.2    
 Environment: PATCH ANN-517 APPLIED (see http://opensource.atlassian.com/projects/hibernate/browse/ANN-517), revision 11026.
    Reporter: Laurent Perez


The XML deserialization of an entity does not deserializes its child properties but only its id, following sample :

Foobean are children of a Screen :

@Entity
@Table (name="foobean")
public class Foobean implements java.io.Serializable {

	private String name;
	private String age;

	private Screen screen;

	@Id
	@Column(name="name")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@ManyToOne
	public Screen getScreen() {
		return this.screen;
	}

	public void setScreen(Screen screen) {
		this.screen = screen;
	}

	@Column(name="age")
	public String getAge() {
		return age;
	}
	public void setAge(String age) {
		this.age = age;
	}
}

Relevant parent  Screen annotations :

        private Set<Foobean> fooBeans = new HashSet<Foobean>();

	@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
	public Set<Foobean> getFoobeans(){
		return this.fooBeans;
	}
	public void setFoobeans(Set<Foobean> fooBeans) {
		this.fooBeans = fooBeans;
	}

Association :

		Foobean foobean = new Foobean();
		foobean.setName("foo");
		foobean.setAge("age");
		foobean.setScreen(screen);
		screen.getFoobeans().add(foobean);

Generated XML (the age property of Foobean is missing, i.e there is no <name>foo</name><age>age</age>) :

<Screen>
<id>1</id>
<foobeans>
<Foobean>foo</Foobean>
</foobeans>
</Screen>



-- 
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.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list