• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JPA entities -- org.hibernate.TypeMismatchException

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Environment:
JDK 1.6, JEE5
Hibernate Core 3.3.1.GA, Hibernate Annotations 3.4.0.GA
DB:Informix

Used reverse engineering to create my persistence entities from db schema [NB:This is a schema in work i cannot change]

Getting exception when selecting list of basic_auth_accounts org.hibernate.TypeMismatchException: Provided id of the wrong type for class ebusiness.weblogic.model.UserAccounts. Expected: class ebusiness.weblogic.model.UserAccountsId, got class ebusiness.weblogic.model.BasicAuthAccountsId

Both basic_auth_accounts and user_accounts have composite primary keys and one-to-one relationships.
Main Code for classes are:


Any clues what to do here? This is pretty important that i get this to work. Cannot find any substantial solution on the net, some say to create an ID class which hibernate has done, and some say not to have a one-to-one relationship.

Please help me!!
 
Shane Lee
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just to follow up on looking/researching online:

From what i can see i have two tables basic_auth_accounts and user_accounts that use the same composite keys realmTypeId, realmQualifier and accountId.
Both entities have embeddable classes with these columns and one-to-one relationships.

I used hibernate tools to generate these entities from the DB schema which i cant change!

Im wondering if i used the same embeddable class for both entities, as in rename BasicAuthAccountsId to a more generic name, remove UserAccountsId and for both entities use the same @EmbeddedId class?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic