简体   繁体   中英

How to include external entities on persistence.xml file

I need to include external entity class files on my persistence.xml file, how can I do it?

I have multiple Eclipse projects that are my system's modules and I have a test in which I need to use a persistence unit that's inside another project, so, how can I make my code "aware" of other entities? How can I list them on my persistence.xml file.

Also, one more detail:

java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
Exception Description: Problem compiling [delete from JpaProfile]. 
[12, 22] The abstract schema type 'JpaProfile' is unknown.
    at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1605)

This is the error which shows up on my Failure trace.

You can explicitly state what classes to use using the <class> tag.

<class>com.test.jpa.entity.Test</class>

So as long as that class is on the class path, you should be good to go.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM