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 5988749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:00:09+00:00 2026-05-22T23:00:09+00:00

I am having trouble getting my entity beans to connect correctly to MySQL. Here’s

  • 0

I am having trouble getting my entity beans to connect correctly to MySQL. Here’s my set up:

JBOSS: 6

UBUNTU: 11.04

EJB: 3.1

I am currently trying to access entity beans via a JNDI remote call to a JARed session bean in the root of my EAR file.

My Entity beans map correctly to my database and work in one EAR file however I want to use the same entity beans in another EAR file in the same container so I have JARed my entity beans and I pull them into my second EAR file using my build script. I am pulling the exact same persistance.xml file as my first EAR file and it points to the same data source XML in the root of my deploy directory. I can define my persistence context and access my entity beans without error and I can compile and deploy my JBoss server without any exceptions. However I get this error when I try to access the entity beans after the container has deployed:

java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [SELECT u FROM User u WHERE u.accountId=:accountId]

This is the query I am using:

List<User> users = entityManager.createQuery("SELECT u FROM User u WHERE u.accountId=:accountId")
        .setParameter("accountId", accountId)
        .getResultList(); 

Can anyone tell me if:

  1. there is an issue with JARing entity beans
  2. does RESTeasy need some special config to deal with entity beans
  3. is it even possible to use JARed entity beans
  4. could there be a config conflict if I am accessing the same datasource using two separate instances of the same entity beans in the same container

Thanks in advance for any help with this. I am really stuck.

ADDED (20/05/2011):

So I have now consolidated my entity and session beans into one jar and have altered the persistence.xml so include the auto detect property suggested by Nayan below:

<property name="hibernate.archive.autodetection" value="class"/>

but to no avail. I have the JAR registered in my application.xml and have added the JAR to the classpath in my build script.

Would it make any sense to put the JAR file into the root of the deploy directory and try to access it from there?

  • 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-05-22T23:00:09+00:00Added an answer on May 22, 2026 at 11:00 pm

    The issue was with the location of my persistence.xml file. I have the persistence.xml file in a JAR with my sessions beans not with my entity beans where it was needed. Problem solved!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi guys I'm having trouble getting my code to correctly display html within the
I'm having trouble getting Twipsy to read the data attributes set on Twipsy-enabled element.
Does ADO.NET Entity Framework 4 work with SQL Server 2005? I'm having trouble getting
having trouble getting multiple lines to work correctly in a mailto link In my
I'm having trouble getting the windsor container and entity framework working together and it
Having trouble getting this to apply in MySQL Workbench 5.2.15 DELIMITER // CREATE DEFINER=`potts`@`%`
I'm quite new to using the entity framework and I'm having trouble getting my
Im having trouble getting my head round subqueries in Mysql. Fairly simple ones are
I am having trouble getting my chat application working correctly. I have 2 textbox's,
I am having trouble getting a my XCode 4.2 project to run against a

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.