2

I have an EJB and a WEB module in my IntelliJ, created 5 entities that I would hope to load into a database using annotations.

I go to project settings, under modules, and select that I want to add JPA facet, I know have a EJB, WEB and JPA facet. I use eclipselink, so I checked that under JPA settings, I then added my persistence.xml file, configured the file.

Problem is that when deploying, it simply will not deploy the persistence.xml file, which means I can not find it under my glassfish 3.0 server when selecting my application under deployment descriptors. I only find my sun-web-ejb.xml under the EJB module. persistence.xml is not under the WEB module either, but I assume it should be under the EJB module anyway.

Is it intended that my persistence.xml should not be loaded on the server so that I can find the xml file under GF admin console (applications -> EJB module of mine -> deployment descriptors) ?

If this is not intended, is there anything in particular I need to do in IntelliJ to make persistence.xml being deployed on server? Maybe its something in particular I need to do with my JPA facet?

Thank you for any feedback on this, I can ofcourse provide more detailed information about my setup if neccessary.

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
user294937
  • 181
  • 13

1 Answers1

2

I only find my sun-web-ejb.xml under the EJB module.

That's already weird. If I'm not wrong, this is a proprietary deployment descriptor for the Web module.

persistence.xml is not under the WEB module either, but I assume it should be under the EJB module anyway

It all depends on how you package and deploy your entities, which can be done in several ways (see What You May Need to Know About Persistence Unit Packaging Options).

If your entities are packaged in an EJB-JAR, the persistence.xml must be placed in the META-INF directory.

But you could package them inside the Web module, this would be simpler in your case. See the above link.

Is it intended that my persistence.xml should not be loaded on the server so that I can find the xml file under GF admin console (applications -> EJB module of mine -> deployment descriptors)?

I suggest to check that the physical JAR contains the META-INF/persistence.xml.

If this is not intended, is there anything in particular I need to do in IntelliJ to make persistence.xml being deployed on server? Maybe its something in particular I need to do with my JPA facet?

Can't say. Maybe the following link could help: Enabling JPA Support.

Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
  • 1
    Thank you so much for your help, you where right, it depends how I packaged it, so in my case the persistence.xml should not be listed on my GF 3.0 server. Also I want to thank you for some other posts you made regarding EE development, I went and looked at your profile, and saw you recommended a book with JavaEE 6 platform with GF 3.0. That also helped quite a bit. I've also have to admit I was a tiny bit stressed as I have a timetable on my end (school), and I never know when all the enterprise pieces will fall on place. – user294937 Nov 05 '10 at 14:35
  • @user294937: You're welcome. And glad you found some of my other answers also helpful. Thanks for the feedback. – Pascal Thivent Nov 06 '10 at 09:32