-->
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.  [ 5 posts ] 
Author Message
 Post subject: Specifying the storage engine type in hibernate
PostPosted: Wed Oct 15, 2008 5:18 am 
Newbie

Joined: Tue Feb 12, 2008 9:52 am
Posts: 9
Hi,

I have 20 tables in my DB.

Can i make the storage engine type as InnoDB for some tables and MyIsam for other tables.

AFAIK Hibernate provides 2 different dialects for innodb and myisam. But how would i work with both the types at a time. In that case which dialect should i use ?

MySQL version 5.x

Thanks in advance,
Venu


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2008 6:05 am 
Beginner
Beginner

Joined: Fri May 14, 2004 9:50 am
Posts: 28
Hi,

If you simply put the org.hibernate.dialect.MySQL5Dialect
it should work with both engine.

_________________
Eric

http://www.viaxoft.com
http://blog.viaxoft.net


Top
 Profile  
 
 Post subject: hbm2ddl issue
PostPosted: Wed Oct 15, 2008 6:31 am 
Newbie

Joined: Tue Feb 12, 2008 9:52 am
Posts: 9
Thanks Eric.
We are using using annotations to generate the DDL thru hbm2ddl. How can i specify the engine type in the POJO so that i can specify the engine type as per my wish.

Thanks
Venu


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2008 9:03 am 
Beginner
Beginner

Joined: Fri May 14, 2004 9:50 am
Posts: 28
I don't use annotation, but I dont think you can specify it in the annotation.
You should do it in the Hibernate.cfg.xml file.
You can also do it with code :

"Configuration cfg = new Configuration()
.addClass(org.hibernate.auction.Item.class)
.addClass(org.hibernate.auction.Bid.class)
.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLInnoDBDialect")
.setProperty("hibernate.connection.datasource", "java:comp/env/jdbc/test")
.setProperty("hibernate.order_updates", "true");"

_________________
Eric

http://www.viaxoft.com
http://blog.viaxoft.net


Top
 Profile  
 
 Post subject: Re: hbm2ddl issue
PostPosted: Wed Oct 15, 2008 1:01 pm 
Pro
Pro

Joined: Tue Jun 12, 2007 4:13 am
Posts: 209
Location: Berlin, Germany
venuwin wrote:
We are using using annotations to generate the DDL thru hbm2ddl. How can i specify the engine type in the POJO so that i can specify the engine type as per my wish.


As far as I know, there is no annotation which does this. In my project I also use annotations (JPA) and I generate the DDL with Ant and hibernate.cfg.xml; in this file I have this line:
Code:
   <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>


And this has the desired effect:

Code:
create table xyz.ACCOMMODATION (
.....
) type=InnoDB;


Is this what you are looking for?

_________________
Carlo
-----------------------------------------------------------
please don't forget to rate if this post helped you


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