You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Anshuman Srivastava <an...@momentum-tech.com> on 2006/05/02 15:31:27 UTC

Probelm with persistence.xml

Hi

I have a multi module project.My problem is that 2 of my ejb modules have
the depedency upon peristence.xml, which is at the same location as pom.xml.

How to define the dependency in pom.xml for peristence.xml??

My persistence.xml is like--

<?xml version="1.0" encoding="UTF-8"?>

<persistence>
	 <persistence-unit name="dms" transaction-type="JTA">
		<provider>org.hibernate.ejb.HibernatePersistence</provider>
		<jta-data-source>java:/OracleDS</jta-data-source>
		<class>com.dms.dao.RepositoryDAO</class>
		<properties>
			<property name="hibernate.dialect"
value="org.hibernate.dialect.SQLServerDialect" />
			<property name="hibernate.hbm2ddl.auto" value="none" />
			<property name="hibernate.show_sql" value="false" />
		</properties>
	</persistence-unit>

</persistence>

Pleasehelp.

Thanks in advance
Anshuman


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Probelm with persistence.xml

Posted by Wayne Fay <wa...@gmail.com>.
Yes, this is what he's saying. Move the xml file to
src/main/resources/META-INF/ if you want it automatically picked up
and put in META-INF in the resulting jar.

If you don't have a main folder, make one.

This can also be configured in your pom but it is more complicated
than simply moving the file.

Wayne

On 5/2/06, Anshuman Srivastava <an...@gmail.com> wrote:
> I want that  my WAR file should contain peristence.xml.
>
> >> If you need to automagically get your persistence.xml in the archive, >>
> >>then
> >>just put it in src/main/resources/META-INF/persistence.xml and it'll end
> >>up in the correct place
>
> My peristence.xml is at root with pom.xml.So do I need to change the
> position of persistence.xml?I do not have any main folder inside src.
>
> ANshuman
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Probelm with persistence.xml

Posted by Anshuman Srivastava <an...@gmail.com>.
I want that  my WAR file should contain peristence.xml.

>> If you need to automagically get your persistence.xml in the archive, >>
>>then
>>just put it in src/main/resources/META-INF/persistence.xml and it'll end
>>up in the correct place

My peristence.xml is at root with pom.xml.So do I need to change the
position of persistence.xml?I do not have any main folder inside src.

ANshuman


On 5/2/06, Kenney Westerhof <ke...@apache.org> wrote:
>
> On Tue, 2 May 2006, Anshuman Srivastava wrote:
>
> > Thanks Kenny for your reply.I am not using <packaging>par</packaging>.I
> am
> > using <packaging>jar</packaging> as I thought that building jar is
> > sufficient for my final deployable war file.
>
> well, that depends. You don't need par, jar works fine too.
> For a war, you need packaging war but you already knew that.
> If you want to use persistence archives from a WAR you'll need to add
> a dependency from the war to the par, and you need to separately deploy
> the par (or put it in an ear).
>
> >
> > And you are correct that  every ejb module has its own persistence
> manager,I
> > have 2 persistence.xml in 2 ejb modules.
>
> Ah ok, I misunderstood your mail then.
>
>
> > Do I need to change packaging as "par" ?Any other changes required i
> > pom.xmlfor depenedncy on
> > persitsence.xml?I am a first time user of Maven and dont know much about
> > EJB.
>
>
> No you don't need packaging par, since a par is just a jar. The par plugin
> is still in the sandbox anyway.
>
> If you need to automagically get your persistence.xml in the archive, then
> just put it in src/main/resources/META-INF/persistence.xml and it'll end
> up in the correct place.
>
> You don't need a dependency to do that.
>
> -- Kenney
>
> >
> > Anshuman
> >
> >
> > On 5/2/06, Kenney Westerhof <ke...@apache.org> wrote:
> > >
> > > On Tue, 2 May 2006, Anshuman Srivastava wrote:
> > >
> > > Hi,
> > >
> > > Every ejb module has its own persistence manager, so you really need
> > > 2 persistence.xml files (unless I'm wrong..)
> > >
> > > I've got one in src/main/par/META-INF/persistence.xml - you're using
> the
> > > <packaging>par</packaging>, right?
> > >
> > > -- Kenney
> > >
> > > > Hi
> > > >
> > > > I have a multi module project.My problem is that 2 of my ejb modules
>
> > > have
> > > > the depedency upon peristence.xml, which is at the same location as
> > > pom.xml.
> > > >
> > > > How to define the dependency in pom.xml for peristence.xml ??
> > > >
> > > > My persistence.xml is like--
> > > >
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > >
> > > > <persistence>
> > > >        <persistence-unit name="dms" transaction-type="JTA">
> > > >               <provider>org.hibernate.ejb.HibernatePersistence
> > > </provider>
> > > >               <jta-data-source>java:/OracleDS</jta-data-source>
> > > >               <class>com.dms.dao.RepositoryDAO </class>
> > > >               <properties>
> > > >                       <property name="hibernate.dialect"
> > > > value="org.hibernate.dialect.SQLServerDialect" />
> > > >                       <property name=" hibernate.hbm2ddl.auto"
> > > value="none" />
> > > >                       <property name="hibernate.show_sql"
> value="false"
> > > />
> > > >               </properties>
> > > >       </persistence-unit>
> > > >
> > > > </persistence>
> > > >
> > > > Pleasehelp.
> > > >
> > > > Thanks in advance
> > > > Anshuman
> > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > >
> > > --
> > > Kenney Westerhof
> > > http://www.neonics.com
> > > GPG public key: http://www.gods.nl/~forge/kenneyw.key
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
>
> --
> Kenney Westerhof
> http://www.neonics.com
> GPG public key: http://www.gods.nl/~forge/kenneyw.key
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Probelm with persistence.xml

Posted by Kenney Westerhof <ke...@apache.org>.
On Tue, 2 May 2006, Anshuman Srivastava wrote:

> Thanks Kenny for your reply.I am not using <packaging>par</packaging>.I am
> using <packaging>jar</packaging> as I thought that building jar is
> sufficient for my final deployable war file.

well, that depends. You don't need par, jar works fine too.
For a war, you need packaging war but you already knew that.
If you want to use persistence archives from a WAR you'll need to add
a dependency from the war to the par, and you need to separately deploy
the par (or put it in an ear).

>
> And you are correct that  every ejb module has its own persistence manager,I
> have 2 persistence.xml in 2 ejb modules.

Ah ok, I misunderstood your mail then.


> Do I need to change packaging as "par" ?Any other changes required i
> pom.xmlfor depenedncy on
> persitsence.xml?I am a first time user of Maven and dont know much about
> EJB.


No you don't need packaging par, since a par is just a jar. The par plugin
is still in the sandbox anyway.

If you need to automagically get your persistence.xml in the archive, then
just put it in src/main/resources/META-INF/persistence.xml and it'll end
up in the correct place.

You don't need a dependency to do that.

-- Kenney

>
> Anshuman
>
>
> On 5/2/06, Kenney Westerhof <ke...@apache.org> wrote:
> >
> > On Tue, 2 May 2006, Anshuman Srivastava wrote:
> >
> > Hi,
> >
> > Every ejb module has its own persistence manager, so you really need
> > 2 persistence.xml files (unless I'm wrong..)
> >
> > I've got one in src/main/par/META-INF/persistence.xml - you're using the
> > <packaging>par</packaging>, right?
> >
> > -- Kenney
> >
> > > Hi
> > >
> > > I have a multi module project.My problem is that 2 of my ejb modules
> > have
> > > the depedency upon peristence.xml, which is at the same location as
> > pom.xml.
> > >
> > > How to define the dependency in pom.xml for peristence.xml??
> > >
> > > My persistence.xml is like--
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > >
> > > <persistence>
> > >        <persistence-unit name="dms" transaction-type="JTA">
> > >               <provider>org.hibernate.ejb.HibernatePersistence
> > </provider>
> > >               <jta-data-source>java:/OracleDS</jta-data-source>
> > >               <class>com.dms.dao.RepositoryDAO </class>
> > >               <properties>
> > >                       <property name="hibernate.dialect"
> > > value="org.hibernate.dialect.SQLServerDialect" />
> > >                       <property name=" hibernate.hbm2ddl.auto"
> > value="none" />
> > >                       <property name="hibernate.show_sql" value="false"
> > />
> > >               </properties>
> > >       </persistence-unit>
> > >
> > > </persistence>
> > >
> > > Pleasehelp.
> > >
> > > Thanks in advance
> > > Anshuman
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> >
> > --
> > Kenney Westerhof
> > http://www.neonics.com
> > GPG public key: http://www.gods.nl/~forge/kenneyw.key
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Probelm with persistence.xml

Posted by Anshuman Srivastava <an...@gmail.com>.
Thanks Kenny for your reply.I am not using <packaging>par</packaging>.I am
using <packaging>jar</packaging> as I thought that building jar is
sufficient for my final deployable war file.

And you are correct that  every ejb module has its own persistence manager,I
have 2 persistence.xml in 2 ejb modules.

Do I need to change packaging as "par" ?Any other changes required i
pom.xmlfor depenedncy on
persitsence.xml?I am a first time user of Maven and dont know much about
EJB.

Anshuman


On 5/2/06, Kenney Westerhof <ke...@apache.org> wrote:
>
> On Tue, 2 May 2006, Anshuman Srivastava wrote:
>
> Hi,
>
> Every ejb module has its own persistence manager, so you really need
> 2 persistence.xml files (unless I'm wrong..)
>
> I've got one in src/main/par/META-INF/persistence.xml - you're using the
> <packaging>par</packaging>, right?
>
> -- Kenney
>
> > Hi
> >
> > I have a multi module project.My problem is that 2 of my ejb modules
> have
> > the depedency upon peristence.xml, which is at the same location as
> pom.xml.
> >
> > How to define the dependency in pom.xml for peristence.xml??
> >
> > My persistence.xml is like--
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <persistence>
> >        <persistence-unit name="dms" transaction-type="JTA">
> >               <provider>org.hibernate.ejb.HibernatePersistence
> </provider>
> >               <jta-data-source>java:/OracleDS</jta-data-source>
> >               <class>com.dms.dao.RepositoryDAO </class>
> >               <properties>
> >                       <property name="hibernate.dialect"
> > value="org.hibernate.dialect.SQLServerDialect" />
> >                       <property name=" hibernate.hbm2ddl.auto"
> value="none" />
> >                       <property name="hibernate.show_sql" value="false"
> />
> >               </properties>
> >       </persistence-unit>
> >
> > </persistence>
> >
> > Pleasehelp.
> >
> > Thanks in advance
> > Anshuman
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
>
> --
> Kenney Westerhof
> http://www.neonics.com
> GPG public key: http://www.gods.nl/~forge/kenneyw.key
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Probelm with persistence.xml

Posted by Kenney Westerhof <ke...@apache.org>.
On Tue, 2 May 2006, Anshuman Srivastava wrote:

Hi,

Every ejb module has its own persistence manager, so you really need
2 persistence.xml files (unless I'm wrong..)

I've got one in src/main/par/META-INF/persistence.xml - you're using the
<packaging>par</packaging>, right?

-- Kenney

> Hi
>
> I have a multi module project.My problem is that 2 of my ejb modules have
> the depedency upon peristence.xml, which is at the same location as pom.xml.
>
> How to define the dependency in pom.xml for peristence.xml??
>
> My persistence.xml is like--
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <persistence>
> 	 <persistence-unit name="dms" transaction-type="JTA">
> 		<provider>org.hibernate.ejb.HibernatePersistence</provider>
> 		<jta-data-source>java:/OracleDS</jta-data-source>
> 		<class>com.dms.dao.RepositoryDAO</class>
> 		<properties>
> 			<property name="hibernate.dialect"
> value="org.hibernate.dialect.SQLServerDialect" />
> 			<property name="hibernate.hbm2ddl.auto" value="none" />
> 			<property name="hibernate.show_sql" value="false" />
> 		</properties>
> 	</persistence-unit>
>
> </persistence>
>
> Pleasehelp.
>
> Thanks in advance
> Anshuman
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org