Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Multiple entities pointing to the same table
PostPosted: Mon Jun 04, 2012 7:17 pm 
Newbie

Joined: Mon Jun 04, 2012 7:13 pm
Posts: 1
Hi All,

I've got two entities User, and LightUser both pointing at the same underlying database table. The light user is immutable, and only used to provide read-only data to key apis. My integration tests specify create-drop for "pingone.hibernate.hbm2ddl.auto" which modifies tables according to the light user entity. Is there a way to filter one entity from ddl validation/generation?

Raymond


Top
 Profile  
 
 Post subject: Re: Multiple entities pointing to the same table
PostPosted: Mon Jun 10, 2013 7:34 am 
Newbie

Joined: Mon Jun 10, 2013 7:24 am
Posts: 1
Hi,

Did you ever find a solution to this? I am trying to do the same thing. I want to map two entities to the same table. One is a "light" version containing some properties, the other is the "main" entity containing all the properties . In theory there may be many different light versions of the main entity.

This approach seems to work if I create the database tables by hand based on the main entity. But does not work if I use hibernate.hbm2ddl.auto=create-drop to create the tables. Both entities point to the same table so the shape of the table that is created depends on which entity the auto generation tool picks first. Is there a way to mark some entities as "ignore" with respect to the automatic table generation?

thanks
J.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.