EJB3 and @ManyToOne to an interface

Discussions

EJB design: EJB3 and @ManyToOne to an interface

  1. EJB3 and @ManyToOne to an interface (1 messages)

    Hi, I've got SharedObject that gets inherited by client and server-end code as ClientObject, ServerObject. ServerObject is meant to be used with EJB3 while ClientObject knows nothing about it. SharedObject define variable that need to get persisted. I tried defining them as @ManyToOne but I have no idea what to put for targetEntity because at the level of SharedObject, it knows nothing about the implementation it will eventually get mapped to (the implementation does not even exist within the same JAR file or classpath so it can't see it even if it wanted to). As far as I know, I can't use @ManyToOne against interfaces, nor can I define @ManyToOne inside ServerObject for a variable which was declared by a superclass. Any ideas on how to solve this problem? Gili
  2. Re: EJB3 and @ManyToOne to an interface[ Go to top ]

    Your question is very confusing... because using ejb3...there is no concept like client/server/shared objects...if you are referring to DTO or value object pattern... in any case, you can use self referential relationship as mentioned in the link below..(like part-bom-part relationship)... http://java.sun.com/javaee/5/docs/tutorial/doc/PersistenceEJB.html#wp78460 http://java.sun.com/javaee/5/docs/tutorial/doc/ Bhagvan K http://www.jroller.com/page/bhagvank