Hello everybody We've encountered a problem with an Entiy Bean. If we make an instance of the folowing bean persistent while the collection are empty they are added to the database correctly. The retrieval of the data works also.
But: As soon as more than one collection contains more than one element we following problem occurs: The bean-data is fetched by a LEFT OUTER JOIN query (Found out with Ethereal). This causes the collections to contain as much elements as rows are returned by the DBMS. Example Collection1: 3 entries Collection2: 4 entries JOIN causes the collections to contain 12 entries (cartesian product) -> This is an undesired effect. Relevant bean code @Entity(access=AccessType.PROPERTY) | @Table(name="BibliographicData") | public class BibliographicData implements Serializable { | | private int id; | | private List<String> abstracts = new LinkedList<String>(); | private List<String> inventors = new LinkedList<String>(); | private List<String> applicants = new LinkedList<String>(); | | | @OneToMany(fetch=FetchType.EAGER) | public List<String> getAbstracts() { | return abstracts; | } | | @OneToMany(fetch=FetchType.EAGER) | public List<String> getApplicants() { | return applicants; | } | | @OneToMany(fetch=FetchType.EAGER) | public List<String> getInventors() { | return inventors; | } | | .... | } | | | Workaround Removal of @OneToMany causes JBoss to store the collections in serialized form. The problem disappears. Question Is there a clever way to store the collections in separate tables without separating them into individual entity beans? Thanks for your help! Regrads, Mike JBoss Configuration JBoss Version: 4.0.3 SP1 Sun JRE5 Build 1.5.0_06-b05 Debian Linux (Sarge) MySQL 5.0.22 Changes in mysql-ds.xml | <datasources> | <local-tx-datasource> | <jndi-name>MySqlDS</jndi-name> | <connection-url>jdbc:mysql://localhost:3306/jbossdb</connection-url> | <driver-class>com.mysql.jdbc.Driver</driver-class> | <user-name>jboss</user-name> | <password>insertpasswdhere</password> | <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name> | <!-- sql to call when connection is created | <new-connection-sql>some arbitrary sql</new-connection-sql> | --> | <!-- sql to call on an existing pooled connection when it is obtained from pool | <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql> | --> | | <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) --> | <metadata> | <type-mapping>mySQL</type-mapping> | </metadata> | </local-tx-datasource> | </datasources> | View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3956378#3956378 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3956378 Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user