Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8380937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:35:05+00:00 2026-06-09T16:35:05+00:00

I have factored my EJB3 code into: (i) business logic interfaces and POJO entity

  • 0

I have factored my EJB3 code into:

(i) business logic interfaces and POJO entity beans that are used to build the “EJB client jar“, and

(ii) business logic code which implements the business interfaces and does the JPA with the database.

The deployed platform is JBoss AS7.1 with Hibernate JPA.

The idea being that the EJB client jar is the interface which will also be deployed with the war or wars which access the business logic code. I am deploying the EJB3 business logic code as an EAR with no WAR inside (the WAR is deployed independently). Thus, the structure of the top-level business logic EAR is as follows:

.
├── lib
│   ├── commons-lang3-3.1.jar
│   └── Users-client.jar
├── META-INF
│   ├── application.xml
│   └── MANIFEST.MF
└── Users-ejb.jar

In my case above, the Users-client.jar is the EJB client jar (the interface) and the Users-ejb.jar is business logic implementation and JPA code.

The structure of the business logic implementation code (Users-ejb.jar) is:

├── base
│   └── AbstractFacade.class
├── facades
│   ├── PrivateUserDataFacade.class
│   └── UserFacade.class
├── META-INF
│   ├── MANIFEST.MF
│   ├── persistence.xml
│   └── postgres-ds.xml
└── utils
    └── JPUtil.class

Where the persistence.xml contains the following tag:

 <exclude-unlisted-classes>false</exclude-unlisted-classes>  

However, with the above setup, code in the Users-ejb.jar does not recognize the @Entity beans defined the Users-client.jar as entities. This is not a class not found issue as the code compiles and deploys, rather a ‘Not an entity’ exception is thrown at runtime.

So, for instance the following test method in class UserFacade.class:

public String boo(String name)
{                                                                   
    javax.persistence.criteria.CriteriaQuery cq =
      getEntityManager().getCriteriaBuilder().createQuery();
    cq.select(cq.from(User.class)); // <-- exception thrown
    List<User> all = getEntityManager().createQuery(cq).getResultList();
    return "boo"+name;
}             

fails where marked with the trace:

Caused by: java.lang.IllegalArgumentException: Not an entity: class entities.User
at org.hibernate.ejb.metamodel.MetamodelImpl.entity(MetamodelImpl.java:158)
[hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.criteria.QueryStructure.from(QueryStructure.java:136)
[hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.criteria.CriteriaQueryImpl.from(CriteriaQueryImpl.java:177)
[hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at facades.UserFacade.boo(UserFacade.java:46) [Users-ejb.jar:]

What should I do to ensure that classes found in the lib/Users-client.jar are recognized as Entities by my business logic code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:35:07+00:00Added an answer on June 9, 2026 at 4:35 pm

    Define entities in peristence.xml

      <persistence-unit name="YourUnit">
         <class>com.package.User</class>
         <class>com.package.AnotherEntity</class>
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some common set up code that I've factored out to a method
I have an application, which I have re-factored so that I believe it is
I have some code repetition that I really want to get rid of -
I have a factored time series that looks like this: df <- data.frame(a=c(11-JUL-2004, 11-JUL-2005,
I have an entity that has a generic integer parameter fs_in_khz that can be
I have a batch conversion script to turn .mkvs of various dimensions into ipod/iphone
I have a query that looks something like this: select xmlelement(rootNode, (case when XH.ID
I have a vb.net 2.0 program, that has a batch/queue routine to execute tasks
I have re-factored one of the method as shown below ,personally I think it
I have a Play! framework with two actions which contain redundant code. So I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.