-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: sessio.save() issue:HB is sending a wrong query to DB server
PostPosted: Fri Sep 16, 2005 11:20 am 
Newbie

Joined: Fri Sep 16, 2005 10:20 am
Posts: 3
Hello Guys,

I am getting the exception (see below) trying to save a object into my Db. Since I am fairly new with HB, my desing is pretty simple, just a table no relations at all.
Seems to me like HB is constructing and sending a wrong SQL to the server. It gets all fields just fine but no values in the query statement are shown.

Thanks in advance I will appreciate any help.

Cheers,

Jose L


Hibernate version:3.0.5

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="paperless.db.model.Document" table="documents">
<id name="id" column="id" type="java.lang.Long" unsaved-value="0">
<generator class="native"/>
</id>
<property name="docId" column="docId" type="java.lang.String"/>
<property name="description" column="description" type="java.lang.String"/>
<property name="type" column="type" type="java.lang.String"/>
<property name="owner" column="owner" type="java.lang.String"/>
<property name="group" column="group" type="java.lang.String"/>
<property name="realName" column="realName" type="java.lang.String"/>
<property name="note" column="note" type="java.lang.String"/>
<property name="checkInDate" column="checkInDate" type="java.sql.Date"/>
<property name="releaseDate" column="releaseDate" type="java.sql.Date"/>
<property name="expirationDate" column="expirationDate" type="java.sql.Date"/>
<property name="indexed" column="indexed" type="java.lang.Boolean"/>
<property name="inWorkFlow" column="inWorkFlow" type="java.lang.Boolean"/>
<property name="deleted" column="deleted" type="java.lang.Boolean"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Session session = ConnectionFactory.getInstance().getSession();

try {
if( logger.isDebugEnabled()) {
logger.debug("Saving document: ");
logger.debug("DocId: "+doc.getDocId());
logger.debug("Type: "+doc.getType());
logger.debug("Group: "+doc.getGroup());
logger.debug("Owner: "+doc.getOwner());
logger.debug("Note: "+doc.getNote());
logger.debug("Exp Date: "+doc.getExpirationDate());
logger.debug("Rel Date: "+doc.getReleaseDate());
logger.debug("Real Name: "+doc.getRealName());
logger.debug("In Date: "+doc.getCheckInDate());
logger.debug("Indexed: "+doc.isIndexed());
logger.debug("WFlow: "+doc.isInWorkFlow());
logger.debug("Deleted: "+doc.isDeleted());
}
session.save(doc);
session.flush();
}
catch (HibernateException e) {
logger.debug("Unable to add new Document [" + doc.getDocId() + "]. Root Cause: " + e.getMessage());
e.printStackTrace();
throw new RuntimeException(e);
}
finally {
if (session != null) {
try {
session.close();
}
catch (HibernateException e) {
logger.debug("Unable to close Hibernate session. Root Cause: " + e.getMessage());
throw new RuntimeException(e);
}

}
}
Full stack trace of any exception that occurs:

org.hibernate.exception.SQLGrammarException: could not insert: [paperless.db.model.Document]

at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)

at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)

at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1777)

at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2178)

at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:34)

at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)

at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:240)

at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:160)

at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:95)

at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)

at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)

at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)

at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)

at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)

at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481)

at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476)

at paperless.db.services.DocumentService.addDocument(DocumentService.java:223)

at paperless.manager.ContentManager.checkIn(ContentManager.java:71)

at paperless.web.actions.CheckInAction.execute(CheckInAction.java:68)

at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)

at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)

at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)

at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)

at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)

at java.lang.Thread.run(Thread.java:534)

Caused by: java.sql.SQLException: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'group, realName, note, checkInDate, releaseDate, expirationDate

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2851)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)

at com.mysql.jdbc.Connection.execSQL(Connection.java:2385)

at com.mysql.jdbc.Connection.execSQL(Connection.java:2306)

at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1877)

at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1974)

at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1897)

at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1758)

at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1759)

... 50 more

Name and version of the database you are using:
MySql 4.x
The generated SQL (show_sql=true):
10:46:28,499 DEBUG SQL:324 - insert into documents (docId, description, type, owner, group, realName, note, checkInDate, releaseDate, expirationDate, indexed, inWorkFlow, deleted) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)



Debug level Hibernate log excerpt:


10:42:39,953 INFO Environment:464 - Hibernate 3.0.5

10:42:39,953 INFO Environment:482 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.mysql.jdbc.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.max_fetch_depth=1, hibernate.dialect=org.hibernate.dialect.MySQLMyISAMDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=root, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:mysql://10.1.0.26/paperless, hibernate.connection.password=****, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=1}

10:42:40,062 INFO Environment:509 - using java.io streams to persist binary types

10:42:40,062 INFO Environment:510 - using CGLIB reflection optimizer

10:42:40,062 INFO Environment:540 - using JDK 1.4 java.sql.Timestamp handling

10:42:40,343 INFO Configuration:464 - Mapping resource: paperless/db/model/User.hbm.xml

10:42:40,499 DEBUG DTDEntityResolver:42 - trying to locate http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/

10:42:40,499 DEBUG DTDEntityResolver:53 - found http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath


10:42:40,874 INFO HbmBinder:260 - Mapping class: paperless.db.model.User -> user

10:42:40,890 DEBUG HbmBinder:1099 - Mapped property: id -> id

10:42:40,937 DEBUG HbmBinder:1099 - Mapped property: login -> login

10:42:40,937 DEBUG HbmBinder:1099 - Mapped property: name -> name

10:42:40,937 DEBUG HbmBinder:1099 - Mapped property: password -> password

10:42:40,937 DEBUG HbmBinder:1099 - Mapped property: role -> role

10:42:40,937 DEBUG HbmBinder:1099 - Mapped property: group -> group

10:42:40,984 INFO Configuration:464 - Mapping resource: paperless/db/model/Document.hbm.xml

10:42:40,984 DEBUG DTDEntityResolver:42 - trying to locate http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/

10:42:40,984 DEBUG DTDEntityResolver:53 - found http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath

10:42:41,015 INFO HbmBinder:260 - Mapping class: paperless.db.model.Document -> documents

10:42:41,015 DEBUG HbmBinder:1099 - Mapped property: id -> id

10:42:41,015 DEBUG HbmBinder:1099 - Mapped property: docId -> docId

10:42:41,015 DEBUG HbmBinder:1099 - Mapped property: description -> description

10:42:41,015 DEBUG HbmBinder:1099 - Mapped property: type -> type

10:42:41,031 DEBUG HbmBinder:1099 - Mapped property: owner -> owner

10:42:41,031 DEBUG HbmBinder:1099 - Mapped property: group -> group

10:42:41,031 DEBUG HbmBinder:1099 - Mapped property: realName -> realName

10:42:41,031 DEBUG HbmBinder:1099 - Mapped property: note -> note

10:42:41,031 DEBUG HbmBinder:1099 - Mapped property: checkInDate -> checkInDate

10:42:41,031 DEBUG HbmBinder:1099 - Mapped property: releaseDate -> releaseDate

10:42:41,031 DEBUG HbmBinder:1099 - Mapped property: expirationDate -> expirationDate

10:42:41,062 DEBUG HbmBinder:1099 - Mapped property: indexed -> indexed

10:42:41,062 DEBUG HbmBinder:1099 - Mapped property: inWorkFlow -> inWorkFlow

10:42:41,062 DEBUG HbmBinder:1099 - Mapped property: deleted -> deleted

10:42:41,062 DEBUG Configuration:998 - Preparing to build session factory with filters : {}

10:42:41,062 INFO Configuration:875 - processing extends queue

10:42:41,062 INFO Configuration:879 - processing collection mappings

10:42:41,062 INFO Configuration:888 - processing association property references

10:42:41,078 INFO Configuration:917 - processing foreign key constraints

10:42:41,328 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)

10:42:41,328 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 1

10:42:41,328 INFO DriverManagerConnectionProvider:45 - autocommit mode: false

10:42:41,343 INFO DriverManagerConnectionProvider:80 - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://10.1.0.26/paperless

10:42:41,343 INFO DriverManagerConnectionProvider:83 - connection properties: {user=root, password=sistemas}

10:42:41,343 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0

10:42:41,343 DEBUG DriverManagerConnectionProvider:109 - opening new JDBC connection

10:42:41,968 DEBUG DriverManagerConnectionProvider:115 - created connection to: jdbc:mysql://10.1.0.26/paperless, Isolation Level: 4

10:42:41,968 INFO SettingsFactory:77 - RDBMS: MySQL, version: 4.0.22-log

10:42:41,968 INFO SettingsFactory:78 - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.8 ( $Date: 2005/04/14 20:36:13 $, $Revision: 1.27.4.64 $ )

10:42:41,984 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1

10:42:42,078 INFO Dialect:92 - Using dialect: org.hibernate.dialect.MySQLMyISAMDialect

10:42:42,124 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)

10:42:42,124 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)

10:42:42,124 INFO SettingsFactory:125 - Automatic flush during beforeCompletion(): disabled

10:42:42,124 INFO SettingsFactory:129 - Automatic session close at end of transaction: disabled

10:42:42,140 INFO SettingsFactory:136 - JDBC batch size: 15

10:42:42,140 INFO SettingsFactory:139 - JDBC batch updates for versioned data: enabled

10:42:42,140 INFO SettingsFactory:144 - Scrollable result sets: enabled

10:42:42,140 DEBUG SettingsFactory:148 - Wrap result sets: disabled

10:42:42,140 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): enabled

10:42:42,140 INFO SettingsFactory:160 - Connection release mode: null

10:42:42,140 INFO SettingsFactory:184 - Maximum outer join fetch depth: 1

10:42:42,187 INFO SettingsFactory:187 - Default batch fetch size: 1

10:42:42,187 INFO SettingsFactory:191 - Generate SQL with comments: disabled

10:42:42,187 INFO SettingsFactory:195 - Order SQL updates by primary key: disabled

10:42:42,187 INFO SettingsFactory:334 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory

10:42:42,187 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTranslatorFactory

10:42:42,187 INFO SettingsFactory:203 - Query language substitutions: {no='N', true=1, yes='Y', false=0}

10:42:42,218 INFO SettingsFactory:209 - Second-level cache: enabled

10:42:42,218 INFO SettingsFactory:213 - Query cache: disabled

10:42:42,218 INFO SettingsFactory:321 - Cache provider: org.hibernate.cache.HashtableCacheProvider

10:42:42,249 INFO SettingsFactory:228 - Optimize cache for minimal puts: disabled

10:42:42,249 INFO SettingsFactory:233 - Cache region prefix: hibernate.test

10:42:42,249 INFO SettingsFactory:237 - Structured second-level cache entries: disabled

10:42:42,249 DEBUG SQLExceptionConverterFactory:52 - Using dialect defined converter

10:42:42,265 INFO SettingsFactory:261 - Statistics: disabled

10:42:42,265 INFO SettingsFactory:265 - Deleted entity synthetic identifier rollback: disabled

10:42:42,265 INFO SettingsFactory:279 - Default entity-mode: pojo

10:42:42,624 INFO SessionFactoryImpl:152 - building session factory

10:42:42,640 DEBUG SessionFactoryImpl:161 - Session factory constructed with filter configurations : {}

10:42:42,640 DEBUG SessionFactoryImpl:164 - instantiating session factory with properties: {java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.connection.password=sistemas, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, sun.boot.library.path=C:\JBuilderX\jdk1.4\jre\bin, java.vm.version=1.4.2_01-b06, hibernate.proxool.pool_alias=pool1, hibernate.connection.username=root, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=US, sun.os.patch.level=, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\proyectosJB\PaperLess\Tomcat, java.runtime.version=1.4.2_01-b06, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\JBuilderX\jdk1.4\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\, line.separator=

, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, java.naming.factory.url.pkgs=org.apache.naming, os.name=Windows XP, sun.java2d.fontpath=, hibernate.jdbc.batch_versioned_data=true, hibernate.cache.region_prefix=hibernate.test, java.library.path=C:\JBuilderX\jdk1.4\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\j2sdk1.4.2_08\bin; c:\aspectj1.2\bin;C:\Program Files\Bonjour\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;`-†;C:\Program Files\Bonjour, java.specification.name=Java Platform API Specification, java.class.version=48.0, hibernate.connection.pool_size=1, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, os.version=5.1, user.home=C:\Documents and Settings\Administrator, catalina.useNaming=true, user.timezone=America/Los_Angeles, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.4, hibernate.connection.driver_class=com.mysql.jdbc.Driver, catalina.home=C:/JBuilderX/thirdparty/jakarta-tomcat-4.0.6-LE-jdk14, java.class.path=C:\JBuilderX\thirdparty\jakarta-tomcat-4.0.6-LE-jdk14\bin\bootstrap.jar;C:\JBuilderX\jdk1.4\lib\tools.jar, user.name=Administrator, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory, java.vm.specification.version=1.0, java.home=C:\JBuilderX\jdk1.4\jre, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.MySQLMyISAMDialect, hibernate.connection.url=jdbc:mysql://10.1.0.26/paperless, user.language=en, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, hibernate.jdbc.use_streams_for_binary=true, java.version=1.4.2_01, java.ext.dirs=C:\JBuilderX\jdk1.4\jre\lib\ext, sun.boot.class.path=C:\JBuilderX\jdk1.4\jre\lib\rt.jar;C:\JBuilderX\jdk1.4\jre\lib\i18n.jar;C:\JBuilderX\jdk1.4\jre\lib\sunrsasign.jar;C:\JBuilderX\jdk1.4\jre\lib\jsse.jar;C:\JBuilderX\jdk1.4\jre\lib\jce.jar;C:\JBuilderX\jdk1.4\jre\lib\charsets.jar;C:\JBuilderX\jdk1.4\jre\classes, java.vendor=Sun Microsystems Inc., catalina.base=C:/JBuilderX/thirdparty/jakarta-tomcat-4.0.6-LE-jdk14, file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, hibernate.max_fetch_depth=1, sun.cpu.isalist=pentium i486 i386}

10:42:43,562 DEBUG BasicEntityPersister:2220 - Static SQL for entity: paperless.db.model.Document

10:42:43,562 DEBUG BasicEntityPersister:2222 - Version select: select id from documents where id =?

10:42:43,562 DEBUG BasicEntityPersister:2223 - Snapshot select: select document_.id, document_.docId as docId1_, document_.description as descript3_1_, document_.type as type1_, document_.owner as owner1_, document_.group as group1_, document_.realName as realName1_, document_.note as note1_, document_.checkInDate as checkInD9_1_, document_.releaseDate as release10_1_, document_.expirationDate as expirat11_1_, document_.indexed as indexed1_, document_.inWorkFlow as inWorkFlow1_, document_.deleted as deleted1_ from documents document_ where document_.id=?

10:42:43,624 DEBUG BasicEntityPersister:2225 - Insert 0: insert into documents (docId, description, type, owner, group, realName, note, checkInDate, releaseDate, expirationDate, indexed, inWorkFlow, deleted, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

10:42:43,624 DEBUG BasicEntityPersister:2226 - Update 0: update documents set docId=?, description=?, type=?, owner=?, group=?, realName=?, note=?, checkInDate=?, releaseDate=?, expirationDate=?, indexed=?, inWorkFlow=?, deleted=? where id=?

10:42:43,624 DEBUG BasicEntityPersister:2227 - Delete 0: delete from documents where id=?

10:42:43,656 DEBUG BasicEntityPersister:2230 - Identity insert: insert into documents (docId, description, type, owner, group, realName, note, checkInDate, releaseDate, expirationDate, indexed, inWorkFlow, deleted) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

10:42:43,828 DEBUG BasicEntityPersister:2220 - Static SQL for entity: paperless.db.model.User

10:42:43,828 DEBUG BasicEntityPersister:2222 - Version select: select id from user where id =?

10:42:43,828 DEBUG BasicEntityPersister:2223 - Snapshot select: select user_.id, user_.login as login0_, user_.name as name0_, user_.password as password0_, user_.role as role0_, user_.group as group0_ from user user_ where user_.id=?

10:42:43,828 DEBUG BasicEntityPersister:2225 - Insert 0: insert into user (login, name, password, role, group, id) values (?, ?, ?, ?, ?, ?)

10:42:43,859 DEBUG BasicEntityPersister:2226 - Update 0: update user set login=?, name=?, password=?, role=?, group=? where id=?

10:42:43,859 DEBUG BasicEntityPersister:2227 - Delete 0: delete from user where id=?

10:42:43,859 DEBUG BasicEntityPersister:2230 - Identity insert: insert into user (login, name, password, role, group) values (?, ?, ?, ?, ?)

10:42:43,953 DEBUG EntityLoader:95 - Static select for entity paperless.db.model.Document: select document0_.id as id0_, document0_.docId as docId1_0_, document0_.description as descript3_1_0_, document0_.type as type1_0_, document0_.owner as owner1_0_, document0_.group as group1_0_, document0_.realName as realName1_0_, document0_.note as note1_0_, document0_.checkInDate as checkInD9_1_0_, document0_.releaseDate as release10_1_0_, document0_.expirationDate as expirat11_1_0_, document0_.indexed as indexed1_0_, document0_.inWorkFlow as inWorkFlow1_0_, document0_.deleted as deleted1_0_ from documents document0_ where document0_.id=?

10:42:43,984 DEBUG EntityLoader:95 - Static select for entity paperless.db.model.Document: select document0_.id as id0_, document0_.docId as docId1_0_, document0_.description as descript3_1_0_, document0_.type as type1_0_, document0_.owner as owner1_0_, document0_.group as group1_0_, document0_.realName as realName1_0_, document0_.note as note1_0_, document0_.checkInDate as checkInD9_1_0_, document0_.releaseDate as release10_1_0_, document0_.expirationDate as expirat11_1_0_, document0_.indexed as indexed1_0_, document0_.inWorkFlow as inWorkFlow1_0_, document0_.deleted as deleted1_0_ from documents document0_ where document0_.id=?

10:42:44,015 DEBUG EntityLoader:95 - Static select for entity paperless.db.model.Document: select document0_.id as id0_, document0_.docId as docId1_0_, document0_.description as descript3_1_0_, document0_.type as type1_0_, document0_.owner as owner1_0_, document0_.group as group1_0_, document0_.realName as realName1_0_, document0_.note as note1_0_, document0_.checkInDate as checkInD9_1_0_, document0_.releaseDate as release10_1_0_, document0_.expirationDate as expirat11_1_0_, document0_.indexed as indexed1_0_, document0_.inWorkFlow as inWorkFlow1_0_, document0_.deleted as deleted1_0_ from documents document0_ where document0_.id=? for update

10:42:44,062 DEBUG EntityLoader:95 - Static select for entity paperless.db.model.Document: select document0_.id as id0_, document0_.docId as docId1_0_, document0_.description as descript3_1_0_, document0_.type as type1_0_, document0_.owner as owner1_0_, document0_.group as group1_0_, document0_.realName as realName1_0_, document0_.note as note1_0_, document0_.checkInDate as checkInD9_1_0_, document0_.releaseDate as release10_1_0_, document0_.expirationDate as expirat11_1_0_, document0_.indexed as indexed1_0_, document0_.inWorkFlow as inWorkFlow1_0_, document0_.deleted as deleted1_0_ from documents document0_ where document0_.id=? for update

10:42:44,078 DEBUG EntityLoader:95 - Static select for entity paperless.db.model.User: select user0_.id as id0_, user0_.login as login0_0_, user0_.name as name0_0_, user0_.password as password0_0_, user0_.role as role0_0_, user0_.group as group0_0_ from user user0_ where user0_.id=?

10:42:44,078 DEBUG EntityLoader:95 - Static select for entity paperless.db.model.User: select user0_.id as id0_, user0_.login as login0_0_, user0_.name as name0_0_, user0_.password as password0_0_, user0_.role as role0_0_, user0_.group as group0_0_ from user user0_ where user0_.id=?

10:42:44,109 DEBUG EntityLoader:95 - Static select for entity paperless.db.model.User: select user0_.id as id0_, user0_.login as login0_0_, user0_.name as name0_0_, user0_.password as password0_0_, user0_.role as role0_0_, user0_.group as group0_0_ from user user0_ where user0_.id=? for update

10:42:44,109 DEBUG EntityLoader:95 - Static select for entity paperless.db.model.User: select user0_.id as id0_, user0_.login as login0_0_, user0_.name as name0_0_, user0_.password as password0_0_, user0_.role as role0_0_, user0_.group as group0_0_ from user user0_ where user0_.id=? for update

10:42:44,140 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory

10:42:44,140 DEBUG SessionFactoryObjectFactory:76 - registered: 8a8180bc066007e701066007eeac0000 (unnamed)

10:42:44,140 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured

10:42:44,171 DEBUG SessionFactoryImpl:262 - instantiated session factory

10:42:44,171 INFO SessionFactoryImpl:379 - Checking 0 named queries

10:42:44,328 DEBUG SessionImpl:250 - opened session at timestamp: 4615751942844416

10:42:44,421 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)

10:42:44,421 DEBUG ConnectionManager:296 - opening JDBC connection

10:42:44,421 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0

10:42:44,421 DEBUG DriverManagerConnectionProvider:99 - using pooled JDBC connection, pool size: 0

10:42:44,421 DEBUG SQL:324 - select this_.id as id0_, this_.login as login0_0_, this_.name as name0_0_, this_.password as password0_0_, this_.role as role0_0_, this_.group as group0_0_ from user this_ where this_.login=?

10:42:44,453 DEBUG AbstractBatcher:378 - preparing statement

10:42:44,453 DEBUG AbstractBatcher:306 - about to open ResultSet (open ResultSets: 0, globally: 0)

10:42:44,453 DEBUG Loader:405 - processing result set

10:42:44,453 DEBUG Loader:410 - result set row: 0

10:42:44,484 DEBUG Loader:828 - result row: EntityKey[paperless.db.model.User#1]

10:42:44,499 DEBUG Loader:978 - Initializing object from ResultSet: [paperless.db.model.User#1]

10:42:44,499 DEBUG BasicEntityPersister:1651 - Hydrating entity: [paperless.db.model.User#1]

10:42:44,499 DEBUG Loader:429 - done processing result set (1 rows)

10:42:44,499 DEBUG AbstractBatcher:313 - about to close ResultSet (open ResultSets: 1, globally: 1)

10:42:44,499 DEBUG AbstractBatcher:298 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)

10:42:44,515 DEBUG AbstractBatcher:416 - closing statement

10:42:44,515 DEBUG Loader:528 - total objects hydrated: 1

10:42:44,515 DEBUG TwoPhaseLoad:96 - resolving associations for [paperless.db.model.User#1]

10:42:44,546 DEBUG TwoPhaseLoad:167 - done materializing entity [paperless.db.model.User#1]

10:42:44,546 DEBUG PersistenceContext:789 - initializing non-lazy collections

10:42:44,546 DEBUG JDBCContext:322 - after autocommit

10:42:44,546 DEBUG SessionImpl:269 - closing session

10:42:44,546 DEBUG ConnectionManager:317 - closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]

10:42:44,562 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1

10:42:44,562 DEBUG JDBCContext:283 - after transaction completion

10:42:44,562 DEBUG SessionImpl:403 - after transaction completion

*** After Exception ***
10:46:28,421 DEBUG DefaultSaveOrUpdateEventListener:159 - saving transient instance

10:46:28,421 DEBUG AbstractSaveEventListener:133 - saving [paperless.db.model.Document#<null>]

10:46:28,421 DEBUG AbstractSaveEventListener:195 - executing insertions

10:46:28,499 DEBUG BasicEntityPersister:1732 - Inserting entity: paperless.db.model.Document (native id)

10:46:28,499 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)

10:46:28,499 DEBUG ConnectionManager:296 - opening JDBC connection

10:46:28,499 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0

10:46:28,499 DEBUG DriverManagerConnectionProvider:99 - using pooled JDBC connection, pool size: 0

10:46:28,499 DEBUG SQL:324 - insert into documents (docId, description, type, owner, group, realName, note, checkInDate, releaseDate, expirationDate, indexed, inWorkFlow, deleted) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

10:46:28,546 DEBUG AbstractBatcher:378 - preparing statement

10:46:28,546 DEBUG BasicEntityPersister:1612 - Dehydrating entity: [paperless.db.model.Document#<null>]

10:46:28,624 DEBUG AbstractBatcher:298 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)

10:46:28,624 DEBUG AbstractBatcher:416 - closing statement

10:46:28,624 DEBUG JDBCExceptionReporter:63 - could not insert: [paperless.db.model.Document] [insert into documents (docId, description, type, owner, group, realName, note, checkInDate, releaseDate, expirationDate, indexed, inWorkFlow, deleted) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]

10:46:28,734 DEBUG SessionImpl:269 - closing session

10:46:28,734 DEBUG ConnectionManager:317 - closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]

10:46:28,734 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1

10:46:28,734 DEBUG JDBCContext:283 - after transaction completion

10:46:28,734 DEBUG SessionImpl:403 - after transaction completion


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 16, 2005 11:49 am 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
Might be because you have reserved words for column names. Use the backtick with your column names (see http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#mapping-quotedidentifiers)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 16, 2005 12:04 pm 
Beginner
Beginner

Joined: Tue Aug 16, 2005 11:06 pm
Posts: 46
Alternatively, change the "group" column name to something else. "group" is a reserved word.

<property name="group"
Quote:
column="group"
type="java.lang.String"/>

_________________
Jason Li
Don't forget to rate:)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 16, 2005 3:35 pm 
Newbie

Joined: Fri Sep 16, 2005 10:20 am
Posts: 3
Thanks Guys,

You hit the nail !

I did chages the column to be groups and It work fine. However, I still am wondering why the query's ?s do not get replaced by the real values (see debug entry below).
Is it mean to be that way?

Quote:
15:25:56,874 DEBUG SQL:324 - insert into documents (docId, description, type, owner, groups, realName, note, checkInDate, releaseDate, expirationDate, indexed, inWorkFlow, deleted) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)



Thanks, all


I will rate you Both the best !!!!!!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 10:23 am 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
Yes, it is printing out the exact statement that is sent to the db (through JDBC). The values are bound to those variables (?s) through JDBC, also. But you can see what the values are if you set your hibernate logging to DEBUG. It will print out the values right after it prints the statement. See http://www.hibernate.org/hib_docs/v3/reference/en/html/session-configuration.html#configuration-logging for instructions on setting up logging.


Top
 Profile  
 
 Post subject: Thanks for writting
PostPosted: Mon Sep 19, 2005 11:06 am 
Newbie

Joined: Fri Sep 16, 2005 10:20 am
Posts: 3
Now It makes a lot of sense....!

Thanks a lot!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.