[Hibernate-JIRA] Created: (HHH-5523) Inconsistence between handling of equality ops and LIKE
by Daniel Migowski (JIRA)
Inconsistence between handling of equality ops and LIKE
-------------------------------------------------------
Key: HHH-5523
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5523
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: Hibernate Core 3.3.1, PostgreSQL 8.3
Reporter: Daniel Migowski
These two queries should both be handled, but only the one with the ">" is correctly understood by the HQL Parser, the other fails.
WORKS:
SELECT a.id, a.name, a.articleGroup FROM Article a
WHERE a.articleGroup.hierarchy > (SELECT ag2.hierarchy FROM ArticleGroup ag2 WHERE ag2.id=32)
FAILS:
SELECT a.id, a.name, a.articleGroup FROM Article a
WHERE a.articleGroup.hierarchy LIKE (SELECT ag2.hierarchy FROM ArticleGroup ag2 WHERE ag2.id=32)
About the Entities:
Article has a ManyToOne relation to ArticleGroup, and articleGroup has a hierarchy String attribute, which helps us get some stuff done.
I checked the SVN, and since http://anonsvn.jboss.org/repos/hibernate/core/tags/hibernate-3.5.5-Final/... is nearly the same as mine in v3.3.1 this should be reproducable in the current final version.
--
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
14 years, 4 months
[Hibernate-JIRA] Created: (HHH-2131) SYBASE +select for update is showing deadlock because lock is not working properly
by George Thomas (JIRA)
SYBASE +select for update is showing deadlock because lock is not working properly
----------------------------------------------------------------------------------
Key: HHH-2131
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2131
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.1.3
Environment: sybaseASE 12.5.03 in solaris +hibernate3.1.3
Reporter: George Thomas
I am connecting to Sybase database from hibernate.I tried setting locks using while selecting rows
1.session.load(class,id,LOCKMODE.UPGRADE)
2.session.lock(obj,LOCKMODE.UPGRADE)
I am attaching a sample code while updating a field in table fund after selecting it.
{
Fund fund = null;
ClientCredential credential = new ClientCredential("testDatabase", fund);
org.hibernate.Session session = SessionFactoryManager.getSessionFactory(credential).getCurrentSession();
Transaction transaction = session.beginTransaction();
log.info("Run by " + Thread.currentThread().getName());
fund = (Fund) session.get(Fund.class, new Short((short)12), LockMode.UPGRADE);
fund.setLegalEntityOrgId(fund.getLegalEntityOrgId()+1);
transaction.commit();
}
my requirement was that i wanted to do a select for update.I should acquire lock on certain rows and do a matching and if concurrent request comes ,it should wait till transaction is over that is lock is released.
When I went through the hibernate code,the hibernate is making static queries in the beginning while loading session factory.Since we are appending the holdlock during execution,the sybase dialect is not appending.
As a work around I tested with native sql with holdlock but when I test concurrent request using threads its bombing.Its throwing LockAcquisitionException.( Your server command (family id #0, process id #3777) encountered a deadlock situation.).can anyone give a solution to this problem???
org.hibernate.exception.LockAcquisitionException: could not update: [com.citco.aexeo.common.dataaccess.domain.Fund#12]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:84)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2223)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2118)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2375)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:91)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:233)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:107)
at com.satyam.Testing.doTransaction(Testing.java:103)
at com.satyam.MyRunnable.run(MyRunnable.java:13)
at java.lang.Thread.run(Thread.java:568)
Caused by: com.sybase.jdbc2.jdbc.SybSQLException: Your server command (family id #0, process id #3777) encountered a deadlock situation. Please re-run your command.
at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2636)
at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1996)
at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:204)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:187)
at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1642)
at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate(SybStatement.java:1625)
at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate(SybPreparedStatement.java:91)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2205)
... 14 more
--
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
14 years, 4 months
[Hibernate-JIRA] Commented: (HHH-892) HQL parser does not resolve alias in ORDER BY clause
by Gail Badner (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-892?page=co... ]
Gail Badner commented on HHH-892:
---------------------------------
There is a problem with the patch. If there is an alias that has the same name as a column, the column takes precedence.
This will happen, even if the column has a different alias.
For example, an HQL query like:
"select z.address as name, z.name as address from Zoo z order by name, address"
is resolving to:
<code>
select
zoo0_.street as col_0_0_,
zoo0_.city as col_0_1_,
zoo0_.postalCode as col_0_2_,
zoo0_.country as col_0_3_,
zoo0_.state_prov_id as col_0_4_,
zoo0_.name as col_1_0_
from
Zoo zoo0_
order by
zoo0_.name,
zoo0_.street,
zoo0_.city,
zoo0_.postalCode,
zoo0_.country,
zoo0_.state_prov_id
</code>
It should resolve to:
<code>
select
zoo0_.street as col_0_0_,
zoo0_.city as col_0_1_,
zoo0_.postalCode as col_0_2_,
zoo0_.country as col_0_3_,
zoo0_.state_prov_id as col_0_4_,
zoo0_.name as col_1_0_
from
Zoo zoo0_
order by
col_0_0_,
col_0_1_,
col_0_2_,
col_0_3_,
col_0_4_,
col_1_0_
</code>
> HQL parser does not resolve alias in ORDER BY clause
> -----------------------------------------------------
>
> Key: HHH-892
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-892
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.5.4, 3.6.0.Beta1
> Environment: Hibernate 3.0.5, MySQL, Tomcat
> Reporter: Guido Laures
> Assignee: Gail Badner
> Fix For: 3.6.0.CR1
>
> Attachments: HHH-892.patch, HibernateHavingAliasTest.java
>
>
> When using an alias for an ORDER BY clause this is not always correctly resolved. Example:
> SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY mySum
> does not work because "mySum" is not resolved in the ORDER BY clause which results in an exception telling that mySum is an unknown column.
> Workaround (not to say "hack") is using:
> SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY col_0_0_
--
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
14 years, 4 months