[Hibernate-JIRA] Updated: (HHH-1645) refresh with LockMode on an unitialized proxy does not work
by Laura Dean (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1645?page=c... ]
Laura Dean updated HHH-1645:
----------------------------
Attachment: ProxyTest.java
I've attached a version of ProxyTest.java with 4 new methods to illustrate the issue. It's based on Branch_3_2 in subversion.
testRefreshLockInitializedProxy(): shows that the LockMode is correct for an initialized proxy.
testRefreshLockUninitializedProxy(): shows that it doesn't work for an un-initialized proxy.
testRefreshLockUninitializedProxyThenRead(): shows that even after you read a field, the LockMode is not UPGRADE.
testtLockUninitializedProxy(): shows that the Session.lock method does work as expected.
The first two methods illustrate the problem; the other two just elaborate.
> refresh with LockMode on an unitialized proxy does not work
> -----------------------------------------------------------
>
> Key: HHH-1645
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1645
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1.3
> Reporter: Michael Kopp
> Attachments: ProxyTest.java
>
>
> the DefaultRefreshEventListener.onRefresh method checks if the object in question is an UninitializedProxy.
> if ( source.getPersistenceContext().reassociateIfUninitializedProxy( event.getObject() ) ) return;
> If this is the case it will reassociate it and return.
> The problem is it will lose the LockMode. If the refresh call was actually done with LockMode.upgrade, the result should be a select for update, which does not happen in this case.
> This is especially anoying as it depends on the state of the proxy:
> - unitialized --> no for update
> - initialzed --> select for update
--
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: (ANN-669) More then one @Id silently fail
by Hontvári József (JIRA)
More then one @Id silently fail
-------------------------------
Key: ANN-669
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-669
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.0.ga
Environment: Hibernate 3.2.5, MySQL
Reporter: Hontvári József
Priority: Minor
If two fields have @Id and the class has no @IdClass annotation then the first(?) field will disappear from Hibernate metadata. I.e. you will see in the log in a "EntityLoader Static select for entity..." entry that the select doesn't contain the field.
(If you add an @IdClass or leaves only one @Id annotation makes the column appear again.)
The first problem is that is doesn't say anything, even on trace logging level, it just fails in a strange way.
The second is that I belive the @IdClass shouldn't be required anyway. There is a similar construct in the xml mapping using the composite-id element: if no primary key class is supplied then the entity class itself become the key class. This is not as rude as it seems, just imagine a class of which all attributes are part of the primary key.
--
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-2929) Alias passed in createCriteria is not applied in where clause resulting in bad SQL
by Ashish Tiwari (JIRA)
Alias passed in createCriteria is not applied in where clause resulting in bad SQL
----------------------------------------------------------------------------------
Key: HHH-2929
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2929
Project: Hibernate3
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.0.ga
Environment: Linux, Oracle 10g, Hibernate 3.2.0 ga
Reporter: Ashish Tiwari
Alias passed in createCriteria is not replaced in the "where" clause of the SQL. This results in incorrect SQL.
Source code:
List aTypeSDLs = session.createCriteria(Dldefinition.class, "Dldefinition")
.add(Expression.eq("Dldefinition.type", aSDLType.toString()))
.add(Expression.eq("Dldefinition.name", aSDLName)).list();
SQL generated by hibernate:
Hibernate: select dldefiniti0_.DLDEFINITIONID as DLDEFINI1_15_0_, dldefiniti0_.Version as Version15_0_, dldefiniti0_.NAME as NAME15_0_, dldefiniti0_.TYPE as TYPE15_0_, dldefiniti0_.DEFINITION as DEFINITION15_0_ from DLDEFINITION dldefiniti0_ where this_.TYPE=? and this_.NAME=?
2007-11-02 11:43:50,340 WARN org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:71) - SQL Error: 904, SQLState: 42000
2007-11-02 11:43:50,341 ERROR org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:72)- ORA-00904: "THIS_"."NAME": invalid identifier
Problem: Notice that the alias in where clase is not replaced. The alias used in where is default "this_", resulting in incorrect SQL.
Stack trace:
org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:2147) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) at org.hibernate.loader.Loader.list(Loader.java:2023) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:95) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) at com.avaya.coreservice.admin.subsystem.metadata.SDLDataInterfaceHibernateImpl.addSDLInstance(SDLDataInterfaceHibernateImpl.java:197) at com.avaya.coreservice.admin.subsystem.metadata.MetaDataManager.addSDLInstance(MetaDataManager.java:304) at com.avaya.coreservice.admin.subsystem.install.ConfigureSDLData.loadSDL(ConfigureSDLData.java:114) at com.avaya.coreservice.admin.subsystem.install.ConfigureSDLData.loadSDL(ConfigureSDLData.java:89) at com.avaya.coreservice.admin.subsystem.install.ConfigureSDLData.configure(ConfigureSDLData.java:166) at com.avaya.coreservice.admin.subsystem.install.ConfigureSDLData.main(ConfigureSDLData.java:69)Caused by: java.sql.SQLException: ORA-00904: "THIS_"."NAME": invalid identifier at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:799)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1039)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:839)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1132)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3329)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1668)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2144)
... 11 more
This problem doesn't happen always. Interesting part is I do not always see my alias used in the SQL. When it works the same code results in following SQL (alias completly ignored):
Hibernate: select this_.DLDEFINITIONID as DLDEFINI1_15_0_, this_.Version as Version15_0_, this_.NAME as NAME15_0_, this_.TYPE as TYPE15_0_, this_.DEFINITION as DEFINITION15_0_ from DLDEFINITION this_ where this_.TYPE=? and this_.NAME=?
It is the same code that occassionaly results in the failure mentioned above. I don't know condition triggers alias getting used versus ignoring. I can try to look up myself if someone can provide some direction on what would cause this different SQL generation from the same code. How can I enforce Hibernate to always use alias?
I appreciate any help with this.
-Ashish
--
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-1753) DB2Dialect.getCurrentTimestampSQLFunctionName() uses Oracle syntax
by Philippe Mouawad (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1753?page=c... ]
Philippe Mouawad updated HHH-1753:
----------------------------------
Attachment: patch-db2dialect-currentTime.txt
Hello,
Here is the patch for getCurrentTimestampSQLFunctionName with DB2Dialect class, patch created from version 3.2.5 of Hibernate.
It would be nice from you to include it in next release.
It is a blocking issue for me since I am using it to be portable accross 3 DB for a Query that cannot be written in HQL.
Philippe
www.ubik-ingenierie.com
> DB2Dialect.getCurrentTimestampSQLFunctionName() uses Oracle syntax
> ------------------------------------------------------------------
>
> Key: HHH-1753
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1753
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1.3
> Environment: Hibernate 3.1.3, DB2 UDB Express-C 8.1 on Windows XP Professional SP2
> Reporter: Carey Evans
> Priority: Minor
> Attachments: patch-db2dialect-currentTime.txt
>
>
> The DB2Dialect class overrides Dialect.getCurrentTimestampSQLFunctionName() to return "sysdate". However, DB2 supports the standard "current_timestamp" value, not the new value, which appears to be from Oracle:
> db2 => select sysdate from sysibm.sysdummy1
> SQL0206N "SYSDATE" is not valid in the context where it is used.
> SQLSTATE=42703
> db2 => select current_timestamp from sysibm.sysdummy1
> 1
> --------------------------
> 2006-05-16-13.13.47.625000
> 1 record(s) selected.
> It looks to me like the method should be removed from the DB2Dialect class.
--
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-2925) Property with access=noop results in org.hibernate.PropertyNotFoundException
by H. Duong (JIRA)
Property with access=noop results in org.hibernate.PropertyNotFoundException
----------------------------------------------------------------------------
Key: HHH-2925
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2925
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.4.sp1
Environment: Hibernate 3.2.4.sp1, MSSQL/2005, MS sqljdbc-1.0 driver
Reporter: H. Duong
A property with attribute access="noop" results in an exception being thrown: org.hibernate.PropertyNotFoundException
I have the following property declared:
<property name="errorCount" formula="(SELECT COUNT(*) FROM ECLError WHERE AbstractDeliveryIID = abstractDeliveryIID)" access="noop"/>
Even declaring the property with attribute insert="false" & update="false" results in the same exception being thrown:
<property name="errorCount" formula="(SELECT COUNT(*) FROM ECLError WHERE AbstractDeliveryIID = abstractDeliveryIID)" access="noop" insert="false" update="false"/>
Here is the exception stacktrace (I have replaced the actual classname with XXX_CLASSNAME_XXX:
org.hibernate.PropertyNotFoundException: field [errorCount] not found on XXX_CLASSNAME_XXX
org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:122)
org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:114)
org.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropertyAccessor.java:137)
org.hibernate.util.ReflectHelper.getter(ReflectHelper.java:83)
org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:71)
org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:276)
org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:2174)
org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2151)
org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2041)
org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:359)
org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:273)
org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:144)
org.hibernate.cfg.Configuration.add(Configuration.java:669)
org.hibernate.cfg.Configuration.addInputStream(Configuration.java:504)
org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:656)
org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:134)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1201)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:284)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244)
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:82)
javax.servlet.GenericServlet.init(GenericServlet.java:211)
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904)
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867)
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
org.apache.catalina.startup.Catalina.start(Catalina.java:551)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
--
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