Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top