Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » BEST PRACTISE: Referencing Entities in persistence.xml (JAVA SE)?
icon4.gif  BEST PRACTISE: Referencing Entities in persistence.xml (JAVA SE)? [message #1693344] Thu, 23 April 2015 08:02 Go to next message
Eclipse UserFriend
Hi...

our company does build new applications with JPA as underlying framework.

The project strucutre looks like this:

JAVA Project (Main APP with gui)
JAVA Project (Entities with business logic)

Due to this situation, it is necessary that the entity beans must be entered in the persistence.xml by hand (<class>XYZ</class>), otherwise an exception is thrown:
"in thread "main" java.lang.IllegalArgumentException: Unknown entity bean class: class XYZ, please verify that this class has been marked with the @Entity annotation."

Is there a possibility that the entities are found automatically?
What has to be done if i use:

1) a pure java project without using maven
2) maven for dependency management

Kind regards
Reiner

[Updated on: Wed, 29 April 2015 10:25] by Moderator

Re: BEST PRACTISE: Referencing Entities in persistence.xml (JAVA SE)? [message #1694128 is a reply to message #1693344] Thu, 30 April 2015 14:08 Go to previous message
Eclipse UserFriend
Not completely sure if this answers your question, but try taking at look at this documentation for how managed classes, like Entities, can be picked up by the persistence provider: https://www.eclipse.org/eclipselink/documentation/2.6/concepts/app_dev001.htm#BGBHFFAG

If you set the <exclude-unlisted-classes> property to "false" in your persistence unit, managed classes that exist within the persistence root (the directory of META-INF/persistence.xml) should be automatically detected; given that they are annotated accordingly. However, if the classes are not within the root, they must be specifically listed within <class> tags in your persistence units.
Previous Topic:Java 8 issues with nested join fetch
Next Topic:EclipseLink 2.5 and Websphere 8.5.5: "JVMVRFY013 class loading constraint violated" Error
Goto Forum:
  


Current Time: Tue Jul 01 06:01:09 EDT 2025

Powered by FUDForum. Page generated in 0.10491 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top