-->
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.  [ 2 posts ] 
Author Message
 Post subject: two questions on Hibernate shards
PostPosted: Thu May 24, 2012 6:16 am 
Newbie

Joined: Thu May 24, 2012 5:54 am
Posts: 1
Hi,
I'm trying to configuring Hibernate Shards with Spring and it all seems to work fine with org.springframework.transaction.jta.JtaTransactionManager.
But when I configure org.springframework.orm.hibernate3.HibernateTransactionManager, I get an error because it opens a connection in doBegin method:

Code:
Connection con = session.connection();


but this method is undefined in ShardedSessionImpl (throws an UnsupportedOperationException).
Any suggestions for solve this problem?

Another question: I can't fully understand this statement:
"The sorting needs to take place inside Hibernate Shards, and in order for this to happen we require that all objects returned by a Criteria query with an order-by clause implement the Comparable interface. If the type of the objects you return do not implement this interface you'll receive an exception"

For example, if I have a User class with two fields: name and age.
User must implement Comparable interface? Why?

Thanks in advance
Giulio


Top
 Profile  
 
 Post subject: Re: two questions on Hibernate shards
PostPosted: Thu May 24, 2012 8:53 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi Giulio,
sorry but Shards is not being maintained since a long time.

It looks like the Spring utility class requires a new version of Hibernate, but the latest release of Shards is quite old and likely didn't implement the needed methods: you would either have to use an older version of Spring (not sure which version - please check the dates of both releases to get a reasonable guess to try).

As an alternative, you could checkout the sources of Shards and add the methods you need making it compatible with the newer version of Hibernate.

Quote:
For example, if I have a User class with two fields: name and age.
User must implement Comparable interface? Why?

As the quoted document states "sorting needs to take place inside Hibernate Shards" means that Shards will need to perform the sort operation in memory, as the database is not able to do this on multiple shards.

No you don't have to have all your entities to implement Comparable. only those types you use in such criteria as defined in the documentation.

_________________
Sanne
http://in.relation.to/


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