如果我在事务中放置任何类型的ORM操作,我会收到错误。
设置:CentOS 6
,MySQL 5.6
和Lucee 4.5.1
。
代码
<!--- stuff here is fine --->
<cftransaction>
<cfscript>
qryInsert = EntityNew("Game");
<cfscript>
</cftransaction>
或
<cfscript>
//stuff here is fine...
transaction{
qryInsert = EntityNew("Game");
}
</cfscript>
实体
League.cfc
component persistent="true" table="Leagues"{
property name="leagueID" ormtype="int" fieldtype="id" generator="identity";
property name="User" fieldtype="many-to-one" cfc="User" fkcolumn="userID";
property name="LeagueTournamentType" fieldtype="many-to-one" cfc="LeagueTournamentType" fkcolumn="leagueTournamentTypeID";
property name="leagueName" ormtype="string";
property name="leagueAbbr" ormtype="string";
property name="teamName" ormtype="string";
property name="gameInMinutes" ormtype="int";
property name="deleteYN" ormtype="boolean";
property name="showReportYN ormtype="boolean";
}
Season.cfc
component persistent="true" table="Seasons"{
property name="seasonID" ormtype="int" fieldtype="id" generator="identity";
property name="User" fieldtype="many-to-one" cfc="User" fkcolumn="userID";
property name="name" ormtype="string";
property name="deleteYN" ormtype="boolean";
property name="showReportYN" ormtype="boolean";
}
User.cfc
component persistent="true" table="Users"{
property name="userID" ormtype="int" fieldtype="id" generator="identity";
property name="username" ormtype="string";
property name="pwd" ormtype="string";
property name="email" ormtype="string";
property name="Language" fieldtype="many-to-one" cfc="Language" fkcolumn="langID";
property name="createdDate" ormtype="timestamp";
property name="lastLoginDate" ormtype="timestamp";
property name="activatedYN" ormtype="boolean";
}
有问题:
Lucee 4.5.1.022 Error (java.lang.StackOverflowError)
Message java.lang.StackOverflowError
Cause java.lang.StackOverflowError
Java Stacktrace java.lang.StackOverflowError
at java.util.HashMap$HashIterator.(HashMap.java:1411):1411
at java.util.HashMap$ValueIterator.(HashMap.java:1456):1456
at java.util.HashMap$Values.iterator(HashMap.java:959):959
at java.util.AbstractCollection.toArray(AbstractCollection.java:180):180
at lucee.runtime.orm.hibernate.SessionFactoryData.getDataSources(SessionFactoryData.java:314):314
at lucee.runtime.orm.hibernate.HibernateORMSession.getDataSources(HibernateORMSession.java:850):850
at lucee.runtime.db.DatasourceManagerImpl.add(DatasourceManagerImpl.java:111):111
at lucee.runtime.PageContextImpl.getORMSession(PageContextImpl.java:3138):3138
at lucee.runtime.orm.ORMUtil.getSession(ORMUtil.java:59):59
at lucee.runtime.orm.ORMUtil.getSession(ORMUtil.java:55):55
at lucee.runtime.orm.hibernate.tuplizer.accessors.CFCGetter.get(CFCGetter.java:71):71
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:230):230
at lucee.runtime.orm.hibernate.tuplizer.AbstractEntityTuplizerImpl.getIdentifier(AbstractEntityTuplizerImpl.java:66):66
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3852):3852
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:80):80
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:190):190
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:147):147
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219):219
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99):99
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50):50
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206):1206
at lucee.runtime.orm.hibernate.HibernateORMTransaction.begin(HibernateORMTransaction.java:40):40
at lucee.runtime.orm.ORMConnection.(ORMConnection.java:61):61
at lucee.runtime.orm.ORMDatasourceConnection.(ORMDatasourceConnection.java:52):52
at lucee.runtime.db.DatasourceManagerImpl._add(DatasourceManagerImpl.java:122):122
at lucee.runtime.db.DatasourceManagerImpl.add(DatasourceManagerImpl.java:113):113
at lucee.runtime.PageContextImpl.getORMSession(PageContextImpl.java:3138):3138
at lucee.runtime.orm.ORMUtil.getSession(ORMUtil.java:59):59
at lucee.runtime.orm.ORMUtil.getSession(ORMUtil.java:55):55
at lucee.runtime.orm.hibernate.tuplizer.accessors.CFCGetter.get(CFCGetter.java:71):71
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:230):230
at lucee.runtime.orm.hibernate.tuplizer.AbstractEntityTuplizerImpl.getIdentifier(AbstractEntityTuplizerImpl.java:66):66
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3852):3852
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:80):80
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:190):190
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:147):147
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219):219
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99):99
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50):50
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206):1206
at lucee.runtime.orm.hibernate.HibernateORMTransaction.begin(HibernateORMTransaction.java:40):40
at lucee.runtime.orm.ORMConnection.(ORMConnection.java:61):61
at lucee.runtime.orm.ORMDatasourceConnection.(ORMDatasourceConnection.java:52):52
at lucee.runtime.db.DatasourceManagerImpl._add(DatasourceManagerImpl.java:122):122
稍后刷新......
Lucee 4.5.1.022 Error (java.lang.StackOverflowError)
Message java.lang.StackOverflowError
Cause java.lang.StackOverflowError
Java Stacktrace java.lang.StackOverflowError
at org.hibernate.util.IdentityMap.entries(IdentityMap.java:93):93
at org.hibernate.event.def.AbstractFlushingEventListener.prepareCollectionFlushes(AbstractFlushingEventListener.java:179):179
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:92):92
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50):50
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206):1206
at lucee.runtime.orm.hibernate.HibernateORMTransaction.begin(HibernateORMTransaction.java:40):40
at lucee.runtime.orm.ORMConnection.(ORMConnection.java:61):61
at lucee.runtime.orm.ORMDatasourceConnection.(ORMDatasourceConnection.java:52):52
at lucee.runtime.db.DatasourceManagerImpl._add(DatasourceManagerImpl.java:122):122
at lucee.runtime.db.DatasourceManagerImpl.add(DatasourceManagerImpl.java:113):113
at lucee.runtime.PageContextImpl.getORMSession(PageContextImpl.java:3138):3138
at lucee.runtime.orm.ORMUtil.getSession(ORMUtil.java:59):59
at lucee.runtime.orm.ORMUtil.getSession(ORMUtil.java:55):55
at lucee.runtime.orm.hibernate.tuplizer.accessors.CFCGetter.get(CFCGetter.java:71):71
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:230):230
at lucee.runtime.orm.hibernate.tuplizer.AbstractEntityTuplizerImpl.getIdentifier(AbstractEntityTuplizerImpl.java:66):66
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3852):3852
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:80):80
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:190):190
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:147):147
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219):219
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99):99
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50):50
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206):1206
at lucee.runtime.orm.hibernate.HibernateORMTransaction.begin(HibernateORMTransaction.java:40):40
at lucee.runtime.orm.ORMConnection.(ORMConnection.java:61):61
at lucee.runtime.orm.ORMDatasourceConnection.(ORMDatasourceConnection.java:52):52
at lucee.runtime.db.DatasourceManagerImpl._add(DatasourceManagerImpl.java:122):122
at lucee.runtime.db.DatasourceManagerImpl.add(DatasourceManagerImpl.java:113):113
at lucee.runtime.PageContextImpl.getORMSession(PageContextImpl.java:3138):3138
at lucee.runtime.orm.ORMUtil.getSession(ORMUtil.java:59):59
at lucee.runtime.orm.ORMUtil.getSession(ORMUtil.java:55):55
at lucee.runtime.orm.hibernate.tuplizer.accessors.CFCGetter.get(CFCGetter.java:71):71
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:230):230
at lucee.runtime.orm.hibernate.tuplizer.AbstractEntityTuplizerImpl.getIdentifier(AbstractEntityTuplizerImpl.java:66):66
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3852):3852
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:80):80
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:190):190
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:147):147
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219):219
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99):99
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50):50
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206):1206
更新#1
使用任何类型的ORM代码或尝试加载任何实体都会产生此错误。
我确实有Game
的实体,我没有粘贴相关代码。
我更改了实体并获得了相同的错误:
transaction{
qryInsert = EntityNew("Game");
}
这次遇到了一个新的错误,然后刷新并落入前面指定的相同堆栈跟踪中。
Lucee 4.5.1.022 Error (java.lang.StackOverflowError)
Message java.lang.StackOverflowError
Cause java.lang.StackOverflowError
Java Stacktrace java.lang.StackOverflowError
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3852):3852
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:80):80
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:190):190
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:147):147
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219):219
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99):99
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50):50
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206):1206
at lucee.runtime.orm.hibernate.HibernateORMTransaction.begin(HibernateORMTransaction.java:40):40
at lucee.runtime.orm.ORMConnection.(ORMConnection.java:61):61
at lucee.runtime.orm.ORMDatasourceConnection.(ORMDatasourceConnection.java:52):52
更新#2
ORM设置:
<cfset THIS.ormEnabled = true>
<cfset THIS.datasource = "abc">
<cfset THIS.ormSettings = {logsql = true, cfclocation="entity", dbCreate = "none", dialect = "MySQLwithInnoDB"}>
<cfset THIS.invokeImplicitAccessor = true>
更新#3
解决方案,在我的ORM设置中添加autoManageSession
:
<cfset THIS.ormSettings = {logsql = true, cfclocation="entity", dbCreate = "none", dialect = "MySQLwithInnoDB", autoManageSession = false}>
答案 0 :(得分:1)
在您给出的示例中,您尝试加载“游戏”实体,您尚未定义(或至少未包含)。我怀疑你得到的堆栈跟踪来自它试图转储太多数据。
如果您尝试以下内容会发生什么:
<cfscript>
transaction{
qryInsert = EntityNew("Season");
qryInsert.setName('testing');
EntitySave(qryInsert);
}
</cfscript>