tag:blogger.com,1999:blog-28228406.post4345916759937083694..comments2024-03-27T00:44:17.190-04:00Comments on Java How To ...: Where to put persistence.xml in web app?Unknownnoreply@blogger.comBlogger13125tag:blogger.com,1999:blog-28228406.post-82997786285337590942011-11-28T12:14:20.555-05:002011-11-28T12:14:20.555-05:00i want to develop servlet to jpa communication the...i want to develop servlet to jpa communication then, that time where we should put META-INF folder?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-28228406.post-73645493753588004782011-06-24T08:16:34.332-04:002011-06-24T08:16:34.332-04:00Thanks for your help at a critical timeThanks for your help at a critical timeAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-28228406.post-49665462197316416902011-01-21T08:01:44.701-05:002011-01-21T08:01:44.701-05:00If you meant EAR file, yes. You can have EAR/lib/...If you meant EAR file, yes. You can have EAR/lib/foo.jar, which contains META-INF/persistence.xml. This persistence unit will be accessible to the whole EAR.javahowtohttps://www.blogger.com/profile/18276646603642614642noreply@blogger.comtag:blogger.com,1999:blog-28228406.post-19385382182129087372011-01-21T00:12:53.635-05:002011-01-21T00:12:53.635-05:00is it possible to put the persistence.xml file in ...is it possible to put the persistence.xml file in an aar file and load it from there?<br /><br />Currently I have to copy and rename the aar to jar and put it under tomcat's WEB-INF\lin folder.<br /><br />ThanksAnonymoushttps://www.blogger.com/profile/17777639147271534324noreply@blogger.comtag:blogger.com,1999:blog-28228406.post-87917166415913250172011-01-20T07:12:20.160-05:002011-01-20T07:12:20.160-05:00Thanks !Thanks !Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-28228406.post-74592311870900639972010-09-29T02:41:23.805-04:002010-09-29T02:41:23.805-04:00Thank you so much for the information.
It took me...Thank you so much for the information. <br />It took me ages to find the correct setup: when I imported a Netbeans project into my Eclipse workspace, suddenly I had to tell Eclipse where to put the file on deployment... your post saved the (second) day.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-28228406.post-62632510185767062942009-11-02T14:10:10.689-05:002009-11-02T14:10:10.689-05:00persistence.xml is part of your application and th...persistence.xml is part of your application and therefore it's best to include it inside your app. It's easier to maintain and understand your app as a self-contained package. If you don't want to change the datasource name in persistence.xml, you can just modify its definition attributes in Tomcat.<br /><br />Technically, I don't see a way to achieve that. The provider will need a way to relate your persistence.xml to all Entities, and discover all Entities that should be managed. JPA allows an app to enumerate all Entity classes in persistence.xml explicitly. But that's even more trouble than what you are trying to do.javahowtohttps://www.blogger.com/profile/18276646603642614642noreply@blogger.comtag:blogger.com,1999:blog-28228406.post-33483433775182364272009-10-30T11:34:06.169-04:002009-10-30T11:34:06.169-04:00Hello,
I am working on project which uses EclipseL...Hello,<br />I am working on project which uses EclipseLink and OSGi on Tomcat server. If I put persistence.xml in EclipseLink bundle (META-INF\persistence.xml) and deploy it in tomcat with bridge.war, it works very fine.<br /><br />But I want to take out persistence.xml out of bundle jar and put that somewhere in Tomcat environment so that DB can be configured without changing the bundle jar.<br /><br />My question is: Can I put META-INF\persistence.xml in tomcat environment where EclipseLink bundle is in bridge\WEB-INF\eclipse\plugin? If yes, please suggest me, where should I put it.<br /><br />Thank you very much in advance.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-28228406.post-52572089350249824632009-07-19T08:28:37.189-04:002009-07-19T08:28:37.189-04:00Thanks.. finally placed the persistence.xml file i...Thanks.. finally placed the persistence.xml file in right place.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-28228406.post-3505692921171981222008-10-21T05:18:00.000-04:002008-10-21T05:18:00.000-04:00I've discovered that now.It turns out that it's ev...I've discovered that now.<BR/><BR/>It turns out that it's even more exciting if you're using Spring for dependency injection (transaction management) and Hibernate (JPA provider/Entity Manager)... you need to have your EntityManagerFactory beans definitions in the same compilation unit as the persistence unit if you want Spring to discover the @Entity classes automagically.Ben Ketteridgehttps://www.blogger.com/profile/17529525432307797030noreply@blogger.comtag:blogger.com,1999:blog-28228406.post-43986393864018875332008-10-20T09:33:00.000-04:002008-10-20T09:33:00.000-04:00If each entity jar is self-contained, meaning it c...If each entity jar is self-contained, meaning it contains all the entity classes and its own persistence.xml, you can just include all such entity jar files in WEB-INF/lib. So you webapp will have multiple persistence.xml, each defining its own persistence unit.javahowtohttps://www.blogger.com/profile/18276646603642614642noreply@blogger.comtag:blogger.com,1999:blog-28228406.post-36916140392753826472008-10-20T06:39:00.000-04:002008-10-20T06:39:00.000-04:00I wonder if you know how to approach this if you n...I wonder if you know how to approach this if you need multiple 'my-entities.jar' files? I.e. if you have multiple persistence units, each with it's own jar file.Ben Ketteridgehttps://www.blogger.com/profile/17529525432307797030noreply@blogger.comtag:blogger.com,1999:blog-28228406.post-20635382442077406702008-10-16T14:25:00.000-04:002008-10-16T14:25:00.000-04:00Thanks. Simple information that took 1/2 a day to...Thanks. Simple information that took 1/2 a day to find because it wasn't listed anywhere else.Anonymousnoreply@blogger.com