Thanks for fast reply, but I still having problems get it working.

The following schema is generated

CREATE TABLE t_customer
  | (
  |   customer_id int8 NOT NULL,
  |   firstname varchar(255),
  |   lastname varchar(255),
  |   CONSTRAINT t_customer_pkey PRIMARY KEY (customer_id)
  | ) 
  | WITHOUT OIDS;
  | 
  | CREATE TABLE t_friendship
  | (
  |   customer bytea NOT NULL,
  |   friend bytea NOT NULL,
  |   created timestamp,
  |   CONSTRAINT t_friendship_pkey PRIMARY KEY (customer, friend)
  | ) 
  | WITHOUT OIDS;


When I deploy the following classes

@Entity
  | @Table(name="t_customer")
  | public class Customer implements Serializable
  | {
  |     private Long pk = null;
  |     private String firstname = null;
  |     private String lastname = null;
  |     
  |     public Customer2()
  |     {
  |     }
  | 
  |     public String getFirstname()
  |     {
  |         return firstname;
  |     }
  | 
  |     public void setFirstname(String name)
  |     {
  |         this.firstname = name;
  |     }
  | 
  |     public String getLastname()
  |     {
  |         return lastname;
  |     }
  | 
  |     public void setLastname(String name2)
  |     {
  |         this.lastname = name2;
  |     }
  | 
  |     @Id
  |     @GeneratedValue(strategy=GenerationType.AUTO)
  |     @Column(name="customer_id")
  |     public Long getPk()
  |     {
  |         return pk;
  |     }
  | 
  |     public void setPk(Long pk)
  |     {
  |         this.pk = pk;
  |     }
  | }



@Embeddable
  | public class FriendshipPK implements Serializable
  | {
  |     private Customer customer = null;
  |     private Customer friend = null;
  |     
  |     public FriendshipPK()
  |     {
  |     }
  | 
  |     public Customer getCustomer()
  |     {
  |         return customer;
  |     }
  | 
  |     public void setCustomer(Customer customer)
  |     {
  |         this.customer = customer;
  |     }
  | 
  |     public Customer getFriend()
  |     {
  |         return friend;
  |     }
  | 
  |     public void setFriend(Customer friend)
  |     {
  |         this.friend = friend;
  |     }
  | 
  | }


@Entity
  | @Table(name="t_friendship")
  | @IdClass(FriendshipPK.class)
  | public class Friendship
  | {
  |     private Customer customer = null;
  |     private Customer friend = null;
  |     
  |     private Date created = null;
  |     
  |     public Friendship()
  |     {
  |     }
  | 
  |     public Date getCreated()
  |     {
  |         return created;
  |     }
  | 
  |     public void setCreated(Date created)
  |     {
  |         this.created = created;
  |     }
  | 
  |     @EmbeddedId
  |     public Customer getCustomer()
  |     {
  |         return customer;
  |     }
  | 
  |     public void setCustomer(Customer customer)
  |     {
  |         this.customer = customer;
  |     }
  | 
  |     @EmbeddedId
  |     public Customer getFriend()
  |     {
  |         return friend;
  |     }
  | 
  |     public void setFriend(Customer friend)
  |     {
  |         this.friend = friend;
  |     }
  | }



There is no difference when using "@Id" instead of "@EmbeddedId" in class 
"Friendship".


It always generates the columns "customer" & "friend" of type "byte" instead of 
"int8".


I am using EJB3 RC4-PFD.


Looking in the docs does not really help, because it always describes PK 
consisting of primitive types.


Would be great if anyone could help me.

Regards
Jan

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3921586


-------------------------------------------------------
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://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to