users@glassfish.java.net

Re: deployment failed due to CMP for Primary Table without primary key

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Thu, 02 Apr 2009 17:43:56 -0700

GlassFish cmp requires primary key in database at least when capturing
dbschema. (Isn't it odd to have a table without primary key persisting
cmps?). If you must not have primary key in database for some reason, a
workaround is to capture schema using captureschema tool against a dummy
schema and bundle it with your cmp app. Look at the developer's guide
for details on how to do it.



glassfish_at_javadesktop.org wrote:
> Hi,
> We are migrating a project from weblogic10 to glassfish v2.We have one CMP for a primary table (no constraints and referenced with any other table) without a primary key.The application is running fine in weblogic but glassfish v2 complaining about the primary key and the deployment is failed.Is there any work around or glassfish doesn't support this feature?
>
> I tried out below work arounds
>
> 1)I created one primary key class and declared one of the cmp-fields as the variable there with getter and setter method.This class implements serializable interface.hashcode() and equals methods are also overridden in this class.
>
> 2)Then I mentioned this class name in ejb-jar.xml as primary key class.
>
> 3)I declared the argument of findByPrimaryKey as this primary key class type.
>
> Still the deployment failed throwing exception stating that primary table should have primary key.
>
> Then I tried using java.lang.Object instead of customized(mentioned above) primary key class but No luck.
>
> Any help or info ?
> [Message sent by forum member 'satyaranjan2006' (satyaranjan2006)]
>
> http://forums.java.net/jive/thread.jspa?messageID=340167
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>