I found out that the simple parent-child example I gave, does not produce the
selection statements I was talking about. Instead a parent-child-grandchild
relation does produce the problem.
I used the following classes to test (the getters and setters are removed here)
:
|
| // Parent
|
| @Entity(access = AccessType.FIELD)
| @Table(name="t_tests", schema="grid")
| @SequenceGenerator(name="TestBeanSequence", sequenceName="grid.s_tests")
| public class TestBean implements Serializable {
|
| @Id(generate=GeneratorType.SEQUENCE, generator="TestBeanSequence")
| private Integer id;
|
| @Column(length=255)
| private String someText;
|
| @Basic(temporalType = TemporalType.TIMESTAMP)
| private Date someDate;
|
| private Boolean someBoolean;
|
| @OneToMany(targetEntity=TestChildBean.class,
| mappedBy="test",
| cascade=CascadeType.ALL,
| fetch=FetchType.LAZY)
| private List<TestChildBean> testChildren;
| }
|
|
| // Child
|
| @Entity(access = AccessType.FIELD)
| @Table(name="t_testchilds", schema="grid")
| @SequenceGenerator(name="TestChildBeanSequence",
sequenceName="grid.s_testchilds")
| public class TestChildBean {
|
| @Id(generate=GeneratorType.SEQUENCE, generator="TestChildBeanSequence")
| private Integer id;
|
| @Column(length=20, nullable=false)
| private String name;
|
| @ManyToOne(targetEntity=TestBean.class, fetch=FetchType.LAZY)
| @JoinColumn(name="test_id", nullable = false)
| private TestBean test;
|
| @OneToMany(targetEntity=TestGrandChildBean.class,
| mappedBy="testChild",
| cascade=CascadeType.ALL,
| fetch=FetchType.LAZY)
| private List<TestGrandChildBean> testGrandChildren;
| }
|
| // Grandchild
|
| @Entity(access = AccessType.FIELD)
| @Table(name="t_testgrandchilds", schema="grid")
| @SequenceGenerator(name="TestGrandChildBeanSequence",
sequenceName="grid.s_testgrandchilds")
| public class TestGrandChildBean {
|
| @Id(generate=GeneratorType.SEQUENCE,
generator="TestGrandChildBeanSequence")
| private Integer id;
|
| @Column(length=20, nullable=false)
| private String name;
|
| @ManyToOne(targetEntity=TestChildBean.class, fetch=FetchType.LAZY)
| @JoinColumn(name="testchild_id", nullable = false)
| private TestChildBean testChild;
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3914539#3914539
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3914539
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user