persistence@glassfish.java.net

Re: New persistence.xml struture

From: Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM>
Date: Wed, 26 Oct 2005 19:37:54 +0530

Hi Michael,
Michael Bouschen wrote:

> Hi Tom,
>
> today I updated the persistence.xml file in my containerless test
> example according to the syntax of the latest packaging proposal.
>
> I have two questions/issues. Do you want me to file issues in the
> glassfish issue tracker system for the two?
>
> (1) I need to include namespace uri in the top most element:
> <persistence xmlns="urn:ejb3-namespace">

It is OK to expect a name space from user in the persistence.xml.
But the correct name space is http://java.sun.com/xml/ns/persistence.
What you have used is the old namespace that was proposed earlier.

Thanks,
Sahoo

> Otherwise, I get a NPE in
> PersistenceUnitProcessor.processPersistenceXML (see attached
> stacktrace in stacktrace1.txt). The code expects to get a list of
> PersistentUnitInfos from the context handler of the XMLReader. W/o the
> namespace uri the XML reader does not find any persistence unit and
> the returned list is null. Is it required to include the namespace uri?
>
> Furthermore, I understand the recent packaging proposal discussion
> there is no requirement that a persistent.xml needs to specify at
> least one persistence unit. So the list of PersistentUnitInfos might
> be empty anyway.
>
> (2) I read the new structure of the persistence.xml file that
> persistence-unit has a required attribute called name:
> <persistence-unit name="containerless">
> The current implementation runs into a NPE for the above line (see
> attached stacktrace in stacktrace2.txt). Instead it accepts a nested
> element called name:
> <persistence-unit>
> <name>containerless</name>
>
> Regards Michael
>
>