users@glassfish.java.net

Re: Unable to make Java2DB work.

From: <glassfish_at_javadesktop.org>
Date: Sun, 15 Jun 2008 17:21:43 PDT

Hey Ming,

 I just saw your post and the blog, but I think the core of the matter is that previous to this discussion I saw no indication that the declaration of the persistence unit on an EJB was mandatory for java2db to work, and in my opinion it should not be.

 I don't see why toplink does not use the persistence.xml to find and create the data tables, it would be the logical step, instead of searching the EJBs for reference.

 On top of that you tie the user to given examples or more extensive/complex coding to achieve the java2db deployment, when it is not really necessary.

  As in my case, I build the project from the ground up, and the persistence in it's own jar, I don't see why it should be packaged with the EJB jar as its classes and persistence model can be reused elsewhere without EJBs, so I deployed it without anyone at first. As I was barred by the deployer that stated that at least one old style entity, EJB should be present in order for the ear to be valid, I wrote one dummy in an separate jar bundled in the ear.

  And then it deployed without error, but also without activating the java2db. And no high quality blog did mention the fact that you must reference the persistence unit in at least one EJB.

  Now, I know that no prodution application would go up without any EJB at all and that if the persistence unit is not referenced, it will not be used and thus it is useless to build the tables, but as I understand it the java2dp is meant to help during development, not to create the final DB schema, and thus it is conceivable that the persistence classes would be written first and the developers would like to see how the DB schema would be created previous to any EJB development.

  []s
  Notivago.
[Message sent by forum member 'notivago' (notivago)]

http://forums.java.net/jive/thread.jspa?messageID=280414