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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:42:36+00:00 2026-06-02T23:42:36+00:00

Code from my Entity Role @Embedded @LazyCollection(LazyCollectionOption.FALSE) @CollectionOfElements @JoinTable(name = TEST_TABLE, joinColumns = @JoinColumn(name

  • 0

Code from my Entity Role

   @Embedded 
   @LazyCollection(LazyCollectionOption.FALSE)
   @CollectionOfElements
   @JoinTable(name = "TEST_TABLE", joinColumns = @JoinColumn(name = "ROLE_ID"))
   @AttributeOverrides({
      @AttributeOverride(name = "code", column = @Column(name = "TSTCODE")),
      @AttributeOverride(name = "work", column = @Column(name = "TSTWRK"))
   })
       private List<TestID> tests;  
}  

TestID class

@Embeddable
@AccessType("field")
public class TestID implements Serializable 
{
   private String code;

   private String work;  

// getters, setters  
}   

Get exception SQLGrammarException

Caused by: java.sql.SQLException: ORA-00904: "TESTS0_"."WORK": invalid identifier   

Entity manager create query that trying get access to columns CODE and WORK instead of TSTCODE and TSTWRk that are in @Column annotations.
Any ideas?

Hibernate-annotation 3.2.1.ga
persistance-api 1.0
jboss-4.2.3.GA

UPDATE:

if rename fields in TestID class to table’s columns names, then all warks normally

@Embeddable
@AccessType("field")
public class TestID implements Serializable 
{
   private String tstcode;

   private String tstwks;  
  • 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-02T23:42:38+00:00Added an answer on June 2, 2026 at 11:42 pm

    Remove @CollectionOfElements and just use @Embedded. I think you’re double-mapping it as it is right now. Also, JPA’s @ElementCollection is recommended over Hibernate’s @CollectionOfElements.

    Update: I kinda missed the fact that you’re mapping a collection of components. You’ll want to add an @Column(name="...") to the fields in your TestID to make it map correctly in that case. Even though it’s somewhat contrary to the way embedded components are supposed to work, that’s the only way I know to do it.

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

Sidebar

Related Questions

I'm using Entity Framework code first and pulling some data back from our database.
I am learning EF Code First from Programming Entity Framework Code First. The following
i am having trouble deciphering this block of code from doctrine documentation /** @Entity
I try to create database from entity framework code first follow with this tutorial
I have a service that gets a JPA entity from outside code. In this
I'm migrating some of our code from LINQ-to-SQL to Entity Framework. Previously, when run
I am getting this error when generate Database from Entity Framework Code First. I
How to create and delete data from entity relationship many-to-many in crm 2011? Code:
Normally the code for using the dbContext from Entity Framework looks something like this:
I'm using EF 4.3.1 code first to load data from entity Users public class

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.