[Hibernate-JIRA] Created: (HHH-4703) (cglib)Instrumented model with abstract MappedSuperclass and field access doesn't work
by Strong Liu (JIRA)
(cglib)Instrumented model with abstract MappedSuperclass and field access doesn't work
--------------------------------------------------------------------------------------
Key: HHH-4703
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4703
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-Beta-2, 3.3.2
Reporter: Strong Liu
Notes:
* test runs fine with cglib, hb 3.2.4 SP1 + ann 3.2.1
* test runs fine with cglib, plain mapping files (trunk).
* no matter if you use annotation or mapping files, test will fail using javassist (it used to fail with previous version too)
So focus on instrumentation done using cglib.
See attached testcase to reproduce the problem.
Guideline:
* testcase the pattern used in hb-core, just using annotations
* run org.hibernate.test.instrument2.runtime.CGLIBInstrumentationTest
* easy to switch from annotation to mapping files in org.hibernate.test.instrument2.cases.AbstractExecutable (comment/uncomment specific lines in getAnnotatedClasses and getXmlFiles)
interesting point: if you complete the source with id setters + annotate the getters (instead of fields) + make the getInterestRate @Transient, the test passes.
--
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
11 years, 8 months
[Hibernate-JIRA] Created: (HHH-6813) @Id @OneToOne cause NullPointerException during query
by Alfio (JIRA)
@Id @OneToOne cause NullPointerException during query
-----------------------------------------------------
Key: HHH-6813
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6813
Project: Hibernate Core
Issue Type: Bug
Components: core, entity-manager
Affects Versions: 4.0.0.CR5, 3.6.8
Environment: Hibernate 4.0.0.CR5, PostgreSQL 9.1.1, Glassfish 3.1.1
Reporter: Alfio
Attachments: hibertest.war, hibertest.zip
I've two entities, Person and PersonInfo, with a one-to-one relation:
{code:title=Person.java}
@Entity
public class Person {
@Id
private Integer id;
@Basic
private String name;
@OneToOne( mappedBy = "id" )
private PersonInfo personInfo;
...getters&setters...
}
{code}
{code:title=PersonInfo.java}
@Entity
public class PersonInfo {
@Id
@OneToOne
private Person id;
@Basic
private String info;
...getters&setters...
}
{code}
Hibernate correctly creates two tables but a NPE occours during a simple select query (only if tables have one or more records)
em.createQuery("SELECT p FROM Person p").getResultList();
...
java.lang.NullPointerException
at org.hibernate.persister.entity.AbstractEntityPersister.loadByUniqueKey(AbstractEntityPersister.java:2202)
at org.hibernate.type.EntityType.loadByUniqueKey(EntityType.java:661)
at org.hibernate.type.EntityType.resolve(EntityType.java:441)
at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:150)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1006)
at org.hibernate.loader.Loader.doQuery(Loader.java:883)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289)
at org.hibernate.loader.Loader.doList(Loader.java:2463)
at org.hibernate.loader.Loader.doList(Loader.java:2449)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2279)
at org.hibernate.loader.Loader.list(Loader.java:2274)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:470)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355)
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1118)
at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:252)
at com.sun.enterprise.container.common.impl.QueryWrapper.getResultList(QueryWrapper.java:195)
at nogroup.hibertest.Bean.execute(Bean.java:23)
at nogroup.hibertest.org$jboss$weld$bean-hibertest-1$0-SNAPSHOT-ManagedBean-class_nogroup$hibertest$Bean_$$_WeldClientProxy.execute(org$jboss$weld$bean-hibertest-1$0-SNAPSHOT-ManagedBean-class_nogroup$hibertest$Bean_$$_WeldClientProxy.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at javax.el.BeanELResolver.invokeMethod(BeanELResolver.java:737)
at javax.el.BeanELResolver.invoke(BeanELResolver.java:467)
at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:254)
at com.sun.el.parser.AstValue.invoke(AstValue.java:228)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:56)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
... 33 more
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 8 months
[Hibernate-JIRA] Created: (HBX-1126) cannot start a jbpm proccess because the hibernated generated query, fails with informix 10
by sergio amaya (JIRA)
cannot start a jbpm proccess because the hibernated generated query, fails with informix 10
-------------------------------------------------------------------------------------------
Key: HBX-1126
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1126
Project: Hibernate Tools
Issue Type: Bug
Environment: informix 10, hibernate tools Version: 3.2.4
Reporter: sergio amaya
Attachments: datasource-ds.xml, hibernate.cfg.xml
i am working with seam + jbpm (jboss tools) and hibernate is creating this query on the jbpm tables:
the strange thing is that i can run the query and it works, im using informix 10
and if i change the database to postgresql (with another datasource), the hole thing works....
... i think is something about the dialect but im not sure, please help me guys!!
Hibernate generated query:
select first 1 processdef0_.ID_ as ID1_4_, processdef0_.NAME_ as NAME3_4_, processdef0_.DESCRIPTION_ as DESCRIPT4_4_, processdef0_.VERSION_ as VERSION5_4_, processdef0_.ISTERMINATIONIMPLICIT_ as ISTERMIN6_4_, processdef0_.STARTSTATE_ as STARTSTATE7_4_ from JBPM_PROCESSDEFINITION processdef0_ where processdef0_.NAME_=? order by processdef0_.VERSION_ desc
and the error is this
16:39:36,491 INFO [LongType] could not read column value from result set: ID1_4_; No such column name
16:39:36,507 WARN [JDBCExceptionReporter] SQL Error: -79738, SQLState: IX000
16:39:36,507 ERROR [JDBCExceptionReporter] No such column name
the stacktrace
16:39:36,710 ERROR [STDERR] org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811)
at org.jbpm.db.GraphSession.findLatestProcessDefinition(GraphSession.java:153)
at org.jbpm.JbpmContext.newProcessInstanceForUpdate(JbpmContext.java:417)
at org.jboss.seam.bpm.BusinessProcess.createProcess(BusinessProcess.java:121)
at org.jboss.seam.bpm.BusinessProcessInterceptor.afterInvocation(BusinessProcessInterceptor.java:106)
at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:49)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:240)
at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:210)
at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:84)
at $Proxy109.iniciarProceso(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
at org.jboss.seam.security.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:40)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
at org.javassist.tmp.java.lang.Object_$$_javassist_3.iniciarProceso(Object_$$_javassist_3.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.ja
16:39:36,710 ERROR [STDERR] va:281)
at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: No such column name
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:348)
at com.informix.jdbc.IfxResultSet.findColumn(IfxResultSet.java:635)
at com.informix.jdbc.IfxResultSet.getLong(IfxResultSet.java:1129)
at org.jboss.resource.adapter.jdbc.WrappedResultSet.getLong(WrappedResultSet.java:724)
at org.hibernate.type.LongType.get(LongType.java:28)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:1097)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:565)
at org.hibernate.loader.Loader.doQuery(Loader.java:701)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
... 121 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
11 years, 8 months
[Hibernate-JIRA] Created: (HHH-6496) ClassCastException inside proxy without explicit casting in application code
by Joseph Calzaretta (JIRA)
ClassCastException inside proxy without explicit casting in application code
----------------------------------------------------------------------------
Key: HHH-6496
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6496
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.6
Environment: Hibernate version 3.6.6
database-independent
JDK 1.6
Windows 7 and Linux
CGLib and javassist
Reporter: Joseph Calzaretta
Attachments: ProxySubclassExample.zip
Noticed that an lazily-loaded entity was getting a ClassCastException inside the proxy method without any explicit casting in the application code. I've pared down the issue to a minimal example and attached a FunctionalTestCase. See:
{code:title=BaseClass.java}
public abstract class BaseClass
{
public abstract SubClass toSubClass();
}
{code}
{code:title=SubClass.java}
public class SubClass extends BaseClass
{
public Subclass toSubClass() {
return this;
}
}
{code}
{code:title=ProxySubclassTest.java}
public void testProxySubclass() throws Exception {
s = this.openSession();
tx = s.beginTransaction();
LazyReferenceToBaseClass lazyReferenceToBaseClass = (LazyReferenceToBaseClass) s.load(LazyReferenceToBaseClass.class, lazyReferenceToBaseClassId);
BaseClass baseClass = lazyReferenceToBaseClass.getBaseClass();
SubClass subClass = baseClass.toSubClass();
// Throws
// java.lang.ClassCastException: BaseClass_$$_javassist_1 cannot be cast to SubClass
// at BaseClass_$$_javassist_1.toSubClass(BaseClass_$$_javassist_1.java)
}
{code}
This is clearly related to "the dreaded proxy problem" with its variety of solutions/workarounds(http://community.jboss.org/wiki/ProxyVisitorPattern) but in those cases the application code makes a mistaken assumption that it can downcast a proxy. In this example, there is no explicit downcasting, although I suppose SubClass.toSubClass() could be considered "implicit downcasting". Within SubClass, "this" must refer to an instance of SubClass, and it presumably should be returnable as such.
I haven't checked what's going on in the proxy code, but I presume that it sees that it is trying to return the item corresponding to the proxy itself, and attempts to return that proxy. However the proxy is not an instance of SubClass and there is a ClassCastException.
I'd suggest one of the following solutions:
- have the proxy return the unproxied (already initialized) object if it cannot cast it appropriately
- have the proxy re-proxy the already initialized object into an instance of the appropriate class
- have some explicit documentation as to why this cannot be expected to work and why domain classes need to avoid this behavior.
In any case it seems poor that even improperly written entity code can cause an exception inside the proxy-specific code.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 8 months
[Hibernate-JIRA] Created: (HBX-1100) hbm2dll creates FK constraint names that are too large for taget database dialect
by Duncan Keysell (JIRA)
hbm2dll creates FK constraint names that are too large for taget database dialect
---------------------------------------------------------------------------------
Key: HBX-1100
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1100
Project: Hibernate Tools
Issue Type: Bug
Affects Versions: 3.2.4 Beta1
Reporter: Duncan Keysell
When hbm2dll creates FK constraint names, it does so without following database resrictions. As hbm2dll knows it is using the Oracle10gDialect then it should not attempt to create FK constraint names that have more than 30 characters. With union-subclass mapping the pattern used by hbm2dll is to give a FK constraint an 18 character name on the class that directly has the association requiring the FK. If that class is subclassed the FK constraint added to the tables of the subclasses has 18+8n characters. Where n is the level of subclassing. Only two levels of subclassing are required before the constraint name exceeds 30 characters as below.
I know it is possible to configure the initial name used for constraints using the foreign-key attribute in the mapping. However if I set that to 1 character then I still have a problem when 1 + 4*8 = 33. Therefore even using the foreign-key attribute I can only get 3 levels of subclassing.
Shouldn't the algorithm to create FK names be aware of the 30 character limit, i.e be dialect aware. Couldn't it simply create a hashcode of the hashcode it currently creates and limit it to 30 characters (including the 'FK').
In the example below constraints of the lengths shown get added to each table for the many-to-one mapping with name="requestedNE":
Class
IACEndpointConfigElement (FK4C10C05A145A4B50) 18 chars
IInterfaceConfigElement (FK4C10C05A145A4B50b6728c4a) 18 + 8 = 26 chars
IFRvcConfigElement (FK4C10C05A145A4B50b6728c4ace4cc838) 18 + 8 + 8 = 34 chars ERROR
Hibernate version:
3.2.2
Mapping documents:
<class name="productSpecific.advancedAppInterfaces.attachmentCircuitService.IACEndpointConfigElement" table="IACEndpointConfigElement" abstract="true">
<many-to-one name="requestedNE"
class="productSpecific.advancedAppInterfaces.attachmentCircuitService.IACServiceNEAssignmentConfigElement"
column="requestedNE_ID"
foreign-key="none"
not-found="ignore"
/>
<union-subclass name="productSpecific.advancedAppInterfaces.attachmentCircuitService.IInterfaceConfigElement" table="IInterfaceConfigElement" abstract="false">
<union-subclass name="productSpecific.advancedAppInterfaces.attachmentCircuitService.IFRvcConfigElement" table="IFRvcConfigElement" abstract="false">
</union-subclass>
</union-subclass>
</class
Code between sessionFactory.openSession() and session.close():
N/A
Full stack trace of any exception that occurs:
N/A
Name and version of the database you are using:
Oracle 10g
The generated SQL (show_sql=true):
[hibernatetool] 2008-11-26 09:56:40,000 DEBUG SchemaExport:303 -
[hibernatetool] create table developer.IFRvcConfigElement (
[hibernatetool] INSTANCEID number(19,0) not null,
[hibernatetool] oid varchar2(2048 char) not null,
[hibernatetool] ReferenceKey varchar2(2048 char),
[hibernatetool] InstanceName varchar2(255 char),
[hibernatetool] InstanceDescription varchar2(255 char),
[hibernatetool] requestedNE_ID number(19,0),
[hibernatetool] ProtocolIFType number(10,0),
[hibernatetool] InterfaceEncapType number(10,0),
[hibernatetool] Dlci number(10,0),
[hibernatetool] primary key (INSTANCEID)
[hibernatetool] );
[hibernatetool] alter table developer.IFRvcConfigElement
[hibernatetool] add constraint FK4C10C05A145A4B50b6728c4ace4cc838
[hibernatetool] foreign key (requestedNE_ID)
[hibernatetool] references developer.IACSrvcNEAssgnmntCnfgElmnt;
[hibernatetool] 2008-11-26 10:00:18,515 ERROR SchemaExport:274 - Unsuccessful: alter table developer.IFRvcConfigElement add constraint FK4C10C05A145A4B50b6728c4ace4cc838 foreign key (requestedNE_ID) references developer.IACSrvcNEAssgnmntCnfgElmnt
[hibernatetool] 2008-11-26 10:00:18,515 ERROR SchemaExport:275 - ORA-00972: identifier is too long
Debug level Hibernate log excerpt:
DEBUG
Problems with Session and transaction handling?
N/A
--
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
11 years, 8 months
[Hibernate-JIRA] Created: (HHH-7002) SchemaExport ERROR when using in-memory database (H2) - drop constraint issue HHH000389
by andrea handevidt (JIRA)
SchemaExport ERROR when using in-memory database (H2) - drop constraint issue HHH000389
---------------------------------------------------------------------------------------
Key: HHH-7002
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-7002
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.0.1
Environment: H2Dialect, Hibernate 4.0
Reporter: andrea handevidt
Priority: Minor
Attachments: HibernateError.zip
HHH-000389 resolved an issue with property name="hibernate.hbm2ddl.auto" value="create". It now performs a drop prior to create. When using an in-memory database this will throw errors on table with foreign key constraints.
ERROR (SchemaExport:426) - HHH000389: Unsuccessful: alter table security_key drop constraint FK3031A4E0BE21E8D7
ERROR (SchemaExport:427) - Table "SECURITY_KEY" not found; SQL statement:alter table security_key drop constraint FK3031A4E0BE21E8D7
I noticed that the sqlDropString for org.hibernate.mapping.Table appends "if exists". This is missing for org.hibernate.mapping.ForeignKey.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 8 months