ORM Int type set as double

Description

using this ORM declaration set lucee to use double instead of int as expected in DB.

property name="id" fieldtype="id" generator="native" notnull="true" default="0" unsavedvalue="0";

Java stack error.

Lucee 4.5.1.000 Error (org.hibernate.MappingException)
Message Bad identifier type: double
Cause org.hibernate.MappingException
Java Stacktrace Bad identifier type: double
at org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifierValue(UnsavedValueFactory.java:95):95
at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:67):67
at org.hibernate.tuple.entity.EntityMetamodel.(EntityMetamodel.java:136):136
at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:475):475
at org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:133):133
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84):84
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:297):297
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385):1385
at lucee.runtime.orm.hibernate.SessionFactoryData.buildSessionFactory(Unknown Source):-1
at lucee.runtime.orm.hibernate.HibernateORMEngine.getSessionFactoryData(Unknown Source):-1
at lucee.runtime.orm.hibernate.HibernateORMEngine.init(Unknown Source):-1
at lucee.runtime.config.ConfigImpl.getORMEngine(Unknown Source):-1
at lucee.runtime.config.ConfigImpl.resetORMEngine(Unknown Source):-1
at lucee.runtime.orm.ORMUtil.resetEngine(Unknown Source):-1
at lucee.runtime.listener.ModernAppListener.initApplicationContext(Unknown Source):-1
at lucee.runtime.listener.ModernAppListener._onRequest(Unknown Source):-1
at lucee.runtime.listener.MixedAppListener.onRequest(Unknown Source):-1
at lucee.runtime.PageContextImpl.execute(Unknown Source):-1
at lucee.runtime.PageContextImpl.execute(Unknown Source):-1
at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(Unknown Source):-1
at lucee.loader.servlet.CFMLServlet.service(Unknown Source):-1
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727):727
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303):303
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208):208
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52):52
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241):241
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208):208
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220):220
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122):122
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504):504
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170):170
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103):103
at mod_cfml.core.invoke(core.java:132):132
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950):950
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116):116
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421):421
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074):1074
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611):611
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314):314
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142):1142
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617):617
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61):61
at java.lang.Thread.run(Thread.java:745):745

Timestamp 4/23/15 8:26:08 AM UTC

Environment

None

Activity

Show:
Imported User 6
April 23, 2015, 11:25 AM

I will try that later ok. Got it and also will check with the solution you already provided in google group to compare if it solves really the problem.

The project is currently built on CF11 but I'm trying my best to validate on lucee so I can offer the switch later.

Imported User 6
April 23, 2015, 4:27 PM

You were definetly right

I made a mistake in identifying the culpurt ORM. Still this worked fine on CF11

<cfcomponent persistent="true" entityname="region" table="geo_regions" accessors="true"
displayname="region" hint="region management" namespace="region" >

<cfproperty name="id" generator="native" type="numeric" fieldtype="id" unsavedvalue="-1" default="-1" hint="department id" >

On lucee changing the numeric ot integer fixes it.

Now I got another nasty bug ... investigating it.

But shouldn't consider this as bug? As it worked flawless on CF11 and I think so on CF10.

Imported User 6
April 23, 2015, 4:28 PM
Julian Halliwell
April 23, 2015, 4:35 PM

Yes it is a bug because `type` is supposed to be a CFML variable type, not the database type, so it should be 'numeric' not 'integer'.

But the important thing to note is that it the exception only occurs when you include both `type="numeric"` and an `unsavedvalue` in the property declaration.

Pothys - MitrahSoft
December 1, 2016, 3:22 PM
Edited

I've added test case for this ticket, cfproperty have attributes with type ='numeric' and unsavedvalue="1" it change the data type numeric to 'double'. It occurs only when you include both attribute type="numeric" and 'unsavedvalue in the property declaration.

pull Request: https://github.com/lucee/Lucee/pull/122

Assignee

Michael Offner

Reporter

Imported User 6

Priority

Minor

Labels

Fix versions

None

Affects versions

Configure