-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Mixing Strategy
PostPosted: Sun Jun 10, 2007 1:47 pm 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
i have a base class that all the classes extend it.

Lets call it Base:

abstract Class Base
String id;
String Name

I dont want to have a table for this class because it will cause to bad performance (all the tables will need to join with this table and all the records will have to write also to this table)

So i used in strategy of table per class.

I all other classes i want to use join, because all the advantage in join strategy.

So how can i set the table per class strategy only for the base class ?
I dont want to use in @MappedSuperClass , because i need this class as an entity.

I read that there is some workaround for this issue, can any one help?

Does any one has a reference to the spec on mixing strategy?

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 11, 2007 7:22 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
there is no other solution. use @MappedSuperclass or even better get rid of this bad practice of having a technical superclass. This was a mistake in EJB 2 and it's a mistake in your code.

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Why do you think it is a mistake?
PostPosted: Tue Jun 12, 2007 1:54 am 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
There are some fields that are required in all the classes.

like:
name,id,version,status

Also, its help a lot in polymorfism, becasue i can write a generic API that retrun the Base class and get the Base class.

I will be very happy to understand why you think this is a bad practice.

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 13, 2007 2:58 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
You should use inheritance for your business concerns, not your technical concerns in the domain model

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.