No, you are not missing anything. Sadly, that's true AFAIK. jndi-name is
environment specific and hence your persistence.xml needs to be
repackaged when you change from one vendor to another. Unlike other
technologies like EJB, JPA folks did not take the path of having a
vendor specific deployment descriptor.
When EE6 comes out, you may be able to specify something like
java:global:... to make it work everywhere. This's my understanding.
Thanks,
Sahoo
glassfish_at_javadesktop.org wrote:
> Hi,
>
> Is there a way to define a JNDI DataSource in persistence.xml that isn't vendor specific? In both Glassfish and JBoss I create a DataSource with the JNDI name [b]ItmaDS[/b].
>
> In Glassfish, I need to use this in my persistence.xml:
>
> [code]
> <persistence-unit name="ItmaPU">
> <jta-data-source>ItmaDS</jta-data-source>
> </persistence-unit>
> [/code]
>
> In JBoss I need to use this:
>
> [code]
> <persistence-unit name="ItmaPU">
> <jta-data-source>java:ItmaDS</jta-data-source>
> </persistence-unit>
> [/code]
>
> I must be missing something because it doesn't make sense that I need to change persistence.xml and re-package my app just to deploy to a different app server. What am I doing wrong?
> [Message sent by forum member 'jptech' (jptech)]
>
> http://forums.java.net/jive/thread.jspa?messageID=359341
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>