I have 2 entity classes:

  | package testing;
  | 
  | import javax.persistence.*;
  | import java.util.List;
  | 
  | @Entity
  | @Table(name = "A")
  | public class A
  | {
  |     @Id
  |     @Column(name = "Id")
  |     private String mId;
  | 
  |     @OneToMany(mappedBy = "mA")
  |     private List<B> mBList;
  | 
  |     //Getter and setters to the members...
  | }
  | 
  | @Entity
  | @Table(name = "B")
  | public class B
  | {
  |     @Id
  |     @Column(name = "Id")
  |     private String mId;
  | 
  |     @ManyToOne
  |     @JoinColumn(name = "AId")
  |     private A mA;
  | 
  |     //Getter and setters to the members...
  | }
  | 

The id column is of type uniqueidentifier and the database is MS SQL Server 
2000.

The following code prints out '0':


  | A a = mEntityManager.find(A.class, "cfaae25a-761b-4430-ba0d-566ddb9bd535");
  | List<B> bList = a.getBList();
  | 
  | System.out.println(bList.size());
  | 

If I have an integer as the primary key this code work without change (except 
for the type) and return 4 B's in the collection. But change the type to 
uniqueidentifier it no longer working.
I have tried the code on glassfish and there it works with uniqueidentifier as 
PK type.


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032355#4032355

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032355
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to