[Hibernate-JIRA] Created: (HSHARDS-9) Add ShardAware interface and related exit strategy logic
by Nathan Silberman (JIRA)
Add ShardAware interface and related exit strategy logic
--------------------------------------------------------
Key: HSHARDS-9
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSHARDS-9
Project: Hibernate Shards
Issue Type: New Feature
Components: strategy
Affects Versions: 3.0.0.Beta1
Environment: Hibernate 3.2, Database: DB2
Reporter: Nathan Silberman
Assignee: Max Ross
Domain model awareness of its host Shard. Any domain model that implemented a 'ShardAware' interface would contain a Set<ShardId> that could be injected by the relevant ExitStrategy.
This could be solved by adding the following interface:
-------------------------------------------------------
package org.hibernate.shards;
import org.hibernate.shards.ShardId;
import java.util.Set;
/**
* Interface for persistent objects that are aware of the virtual shardIds
* that host them.
*/
public interface ShardAware {
/**
* Sets the virtual ShardIds that host the implementing
* persistant object
*
* @param shardid
* a non-null, non-empty Set of ShardIds
* @throws IllegalArgumentException
* if <tt>shardIds</tt> is null or empty
*/
void setShardIds( Set<ShardId> shardids );
}
---------------------------------------------------
An simple exit strategy that could be used, for example, would set the ShardIds for each resulting ShardAware domain model:
------------------------------------------------------
package org.hibernate.shards.strategy.exit;
import java.util.List;
import org.hibernate.shards.Shard;
import org.hibernate.shards.ShardAware;
/**
* ShardAwareConcatenateListsExistStrategy sets the ShardIds on each of the given
* objects returned by each Shard.
*
* One should be aware that usage of this class adds O(n) overhead to each retrieval
* as the setting of each ShardIds Set is invoked by iterating over the entire resultSet.
*/
public class ShardAwareConcatenateListsExistStrategy extends ConcatenateListsExitStrategy {
@Override
public synchronized boolean addResult(List<Object> oneResult, Shard shard ) {
if ( oneResult != null && ! oneResult.isEmpty()
&& oneResult.get( 0 ) instanceof ShardAware ) {
for( Object object : oneResult ) {
((ShardAware)object).setShardIds( shard.getShardIds() );
}
}
return super.addResult( oneResult, shard );
}
}
---------------------------------------
This change might require changes wherever ShardAccessStrategy.apply() could be invoked.
I have made the changes including a small alteration to the ShardedCriteriaImpl, to use ShardAwareConcatenateListsExistStrategy instead of ConcatenateListsExitStrategy, with success.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 4 months
[Hibernate-JIRA] Created: (HHH-2620) Hibernate and Unicode
by Maneesh Chauhan (JIRA)
Hibernate and Unicode
---------------------
Key: HHH-2620
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2620
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.1.3
Environment: Window and Linux , Mysql 5.0
Reporter: Maneesh Chauhan
HI All ,
In My project i would like to insert the multiple language characters like chinese,japanese , Denmark etc . For this , i setup my mysql database with character set utf8 and in the hibernate configuration file connection url is like this
connection.url = jdbc:mysql://localhost/multibyte?useUnicode=true&characterEncoding=UTF-8
But when i am trying to insert the chinese characters in the database by using the hibernate then it shows ???? characters and i retrieve the same row from the database by using hibernate then i got the ????
Please let me know is there any more change should i will have to make to run the things smoothly
Thanks in advance
Maneesh Chauhan
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 4 months
[Hibernate-JIRA] Updated: (HHH-957) SubqueryExpression throws ClassCastException on DetachedCriteria subqueries
by Rob MacGrogan (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-957?page=co... ]
Rob MacGrogan updated HHH-957:
------------------------------
Attachment: SubqueryExpression.java
Patches class cast exception in 3.2.2 version of SubqueryExpression.
> SubqueryExpression throws ClassCastException on DetachedCriteria subqueries
> ---------------------------------------------------------------------------
>
> Key: HHH-957
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-957
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.0.5
> Environment: Oracle 9i, but probably not DB specific.
> Reporter: Rob MacGrogan
> Priority: Minor
> Attachments: subcriteria-patch.txt, SubqueryExpression.java, SubqueryExpression.java, SubqueryExpression.java
>
>
> The toSqlString() method in SubqueryExpression contains a line that casts a Criteria object to CriteriaImpl in order to call the getSession() method. However, if DetachedCriteria is used as a subquery in a Criteria query, the underlying Criteria object will be CriteriaImpl.Subcriteria, thus a ClassCastException will be thrown.
> I have created a bug fix. Add the following method to SubqueryExpression:
> private SessionImpl getSessionImpl(Criteria criteria) {
> SessionImpl session = null;
> if (criteria instanceof CriteriaImpl) {
> CriteriaImpl impl = (CriteriaImpl)criteria;
> session = impl.getSession();
> }
> else if (criteria instanceof CriteriaImpl.Subcriteria){
> CriteriaImpl.Subcriteria sub = (CriteriaImpl.Subcriteria)criteria;
> //Alert! Recursive call here!
> session = getSessionImpl(sub.getParent());
> }
> return session;
> }
> And then replace the offending line in toSqlString() with a call to the new method.
> Attached is SubqueryExpression with proposed changes in place.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 4 months
[Hibernate-JIRA] Commented: (HHH-957) SubqueryExpression throws ClassCastException on DetachedCriteria subqueries
by Rob MacGrogan (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-957?page=co... ]
Rob MacGrogan commented on HHH-957:
-----------------------------------
This bug is still present as of 3.2.2 although the SubqueryExpression class has been completely rewritten. The offending line even as the word "ugly" appended to it as a comment.
I've attached a new patch that works with 3.2.2.
> SubqueryExpression throws ClassCastException on DetachedCriteria subqueries
> ---------------------------------------------------------------------------
>
> Key: HHH-957
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-957
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.0.5
> Environment: Oracle 9i, but probably not DB specific.
> Reporter: Rob MacGrogan
> Priority: Minor
> Attachments: subcriteria-patch.txt, SubqueryExpression.java, SubqueryExpression.java, SubqueryExpression.java
>
>
> The toSqlString() method in SubqueryExpression contains a line that casts a Criteria object to CriteriaImpl in order to call the getSession() method. However, if DetachedCriteria is used as a subquery in a Criteria query, the underlying Criteria object will be CriteriaImpl.Subcriteria, thus a ClassCastException will be thrown.
> I have created a bug fix. Add the following method to SubqueryExpression:
> private SessionImpl getSessionImpl(Criteria criteria) {
> SessionImpl session = null;
> if (criteria instanceof CriteriaImpl) {
> CriteriaImpl impl = (CriteriaImpl)criteria;
> session = impl.getSession();
> }
> else if (criteria instanceof CriteriaImpl.Subcriteria){
> CriteriaImpl.Subcriteria sub = (CriteriaImpl.Subcriteria)criteria;
> //Alert! Recursive call here!
> session = getSessionImpl(sub.getParent());
> }
> return session;
> }
> And then replace the offending line in toSqlString() with a call to the new method.
> Attached is SubqueryExpression with proposed changes in place.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 4 months
[Hibernate-JIRA] Created: (HHH-2815) org.hibernate.stat.SecondLevelCacheStatistics.getEntries fails for Query cache
by sebastien kurz (JIRA)
org.hibernate.stat.SecondLevelCacheStatistics.getEntries fails for Query cache
------------------------------------------------------------------------------
Key: HHH-2815
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2815
Project: Hibernate3
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.2.4.sp1
Environment: Hibernate 3.2.4.sp1 on Oracle with Jboss Treecache 1.4.1 sp4
Reporter: sebastien kurz
Priority: Trivial
Attachments: SecondLevelCacheStatistics.java
sessionFactory.getStatistics().getSecondLevelCacheStatistics("org.hibernate.cache.StandardQueryCache").getEntries();
throws an exception because the cache map key is not of type CacheKey but QueryKey
Here is a fix example:
public Map getEntries() {
Map map = new HashMap();
Iterator iter = cache.toMap().entrySet().iterator();
while ( iter.hasNext() ) {
Map.Entry me = (Map.Entry) iter.next();
if (me.getKey() instanceof CacheKey) {
map.put( ( (CacheKey) me.getKey() ).getKey(), me.getValue() );
} else {
map.put( me.getKey(), me.getValue() );
}
}
return map;
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 4 months
[Hibernate-JIRA] Commented: (HHH-1829) Allow join on any property using property-ref
by John Dewsnip (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829?page=c... ]
John Dewsnip commented on HHH-1829:
-----------------------------------
Any work arounds for this?
Thanks,
John
> Allow join on any property using property-ref
> ---------------------------------------------
>
> Key: HHH-1829
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829
> Project: Hibernate3
> Issue Type: New Feature
> Components: metamodel
> Affects Versions: 3.2.0 cr1, 3.2.0.cr2
> Reporter: Maarten Winkels
> Assignee: Steve Ebersole
> Attachments: AbstractJoinTest.java, HHH-1829-mwinkels.patch, hhh-1829.patch, JoinNoPropertyRefTest.java, JoinPropertyRefTest.java, Person.hbm.xml, Person.java, PersonNoPropertyRef.hbm.xml
>
>
> Currently joining tables for one class (uing the <join...> tag) is only supported for the id property. The property-ref is allowed on the <key..> tag inside the <join..> tag, but this is ignored.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 4 months