Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 12:02 Go to next message
Reiner Lott is currently offline Reiner LottFriend
Messages: 4
Registered: August 2013
Junior Member
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 14:25]

Report message to a moderator

Re: BEST PRACTISE: Referencing Entities in persistence.xml (JAVA SE)? [message #1694128 is a reply to message #1693344] Thu, 30 April 2015 18:08 Go to previous message
Will Dazey is currently offline Will DazeyFriend
Messages: 10
Registered: February 2015
Junior Member
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: Mon Oct 14 12:40:06 GMT 2024

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

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

Back to the top