• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to define Generic Collection types in JPA Entity table column

 
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am trying to define a generic Collection List<String> type into an Entity table column such as the following:



Below is the deployment error message despite having compiled successfully:

pre-run-deploy:
In-place deployment at C:\Documents and Settings\Jack\OrganizationBean\OrganizationBean-ejb\build\jar
Start registering the project's server resources
Finished registering server resources
moduleID=OrganizationBean-ejb
deployment started : 0%
Deploying application in domain failed; Deployment ErrorException [TOPLINK-28018] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
Exception Description: predeploy for PersistenceUnit [OrganizationDB] failed.
Internal Exception: Exception [TOPLINK-7155] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.ValidationException
Exception Description: The type [interface java.util.List] for the attribute [name] on the entity class [class domain.Employee] is not a valid type for a serialized mapping. The attribute type must implement the Serializable interface. -- Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
Deployment error:
The module has not been deployed.
See the server log for details.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:166)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor284.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: The module has not been deployed.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:160)
... 16 more

Can anyone explain what should the columnDefinition="?" be set to when:

( i ) Define a List<String> in the Phone Entity table column above?
( ii ) I also like to have the option of changing the type of this column from List<String> to Map<Date, String> in the future.

This question had been posted on http://forums.sun.com/thread.jspa?threadID=5327831 for a few days without response yet.

Many thanks,

Jack
 
author
Posts: 304
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jack,

JPA 1.0 does not support mapping a collection of Strings so you will have to use the vendor mapping feature. In TopLink you would use a DirectCollection mapping for this.

This support is being added to JPA 2.0, though.
 
Jack Bush
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mike,

Thanks for your response to my question.

Any idea on when JPA 2.0 will be supported in Glassfish?

Does Pro EJB 3.0 covers the capabilities of popular application servers such as Glassfish and JBoss? I regularly come a cross EJB 3.0 examples that run on JBoss but not Glassfish, and vice versa.

More importantly, it appears that TopLink does not support the use of @OneToMany using @JoinColumn - Unidirectional. It insists on implementing a birectionality instead. Is this true?

Thanks,

Jack
reply
    Bookmark Topic Watch Topic
  • New Topic