-->
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: "No tuplizer found for entity-mode [pojo]" error f
PostPosted: Mon Mar 07, 2005 11:38 am 
Newbie

Joined: Thu Jan 20, 2005 9:12 am
Posts: 4
Hello all,

For a simple test with Hibernate's XML mapping capabilities, I tried to save a mapped element to the database. The error message says entity-mode is pojo, while i specified 'dom4j'.

Am I making a mistake somewhere in the code or the mapping file? Both are a rather faithful reproduction of the docu examples.

Best regards, Jos

Hibernate version:
3rc1
Mapping documents:
Code:
<?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 entity-name="database"
                        table="DATABASES"
                        node="database">
                <id name="name"
                                column="NAME"
                                node="@name"
                                type="string"/>
                <property name="url"
                                column="URL"
                                node="@url"
                                type="string"
                                not-null="true"/>
                <property name="username"
                                column="USERNAME"
                                node="@username"
                                type="string"/>
                <property name="password"
                                column="PASSWORD"
                                node="@password"
                                type="string"/>
                <property name="schema"
                                column="SCHEMA"
                                node="@schema"
                                type="string"/>
        </class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
Code:
  Session dom4jSession = session.openSession(EntityMode.DOM4J);
  if (EntityMode.DOM4J != dom4jSession.getEntityMode()) {
   System.out.println("wrong mode");
  }
  Transaction tx = session.beginTransaction();

  Element db = DocumentHelper.createElement("database");
  db.addAttribute("name", "mfungd");
  db.addAttribute("url", "localhost:-)");
  db.addAttribute("username", "user1");
  db.addAttribute("password", "user1");
  db.addAttribute("schema", "whatever");
  session.save(db);

  tx.commit();

Full stack trace of any exception that occurs:
Exception in thread "main" org.hibernate.HibernateException: No tuplizer found for entity-mode [pojo]
at org.hibernate.tuple.TuplizerLookup.getTuplizer(TuplizerLookup.java:142)
at org.hibernate.tuple.EntityMetamodel.getTuplizer(EntityMetamodel.java:86)
at org.hibernate.persister.entity.BasicEntityPersister.getTuplizer(BasicEntityPersister.java:2585)
at org.hibernate.persister.entity.BasicEntityPersister.getIdentifier(BasicEntityPersister.java:2904)
at org.hibernate.id.Assigned.generate(Assigned.java:31)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:85)
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:429)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:424)
at SimpleTest1.go2(SimpleTest1.java:66)
at SimpleTest1.main(SimpleTest1.java:27)

Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
not applicable
Debug level Hibernate log excerpt:
16:10:22,972 INFO Environment:456 - Hibernate 3.0rc1
16:10:22,978 INFO Environment:469 - hibernate.properties not found
16:10:22,981 INFO Environment:502 - using CGLIB reflection optimizer
16:10:22,984 INFO Environment:532 - using JDK 1.4 java.sql.Timestamp handling
16:10:22,985 INFO Configuration:1228 - configuring from resource: /hibernate.cfg.xml
16:10:22,985 INFO Configuration:1199 - Configuration resource: /hibernate.cfg.xml
16:10:23,393 DEBUG DTDEntityResolver:42 - trying to locate http://hibernate.sourceforge.net/hibern ... on-3.0.dtd in classpath under org/hibernate/
16:10:23,394 DEBUG DTDEntityResolver:53 - found http://hibernate.sourceforge.net/hibern ... on-3.0.dtd in classpath
16:10:23,471 DEBUG Configuration:1185 - hibernate.connection.url=jdbc:oracle:thin:@svr10:1521:GENRE02
16:10:23,472 DEBUG Configuration:1185 - hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver
16:10:23,472 DEBUG Configuration:1185 - hibernate.connection.username=devtest01
16:10:23,473 DEBUG Configuration:1185 - hibernate.connection.password=test01
16:10:23,474 DEBUG Configuration:1185 - hibernate.dialect=org.hibernate.dialect.OracleDialect
16:10:23,474 DEBUG Configuration:1185 - hibernate.show_sql=false
16:10:23,474 DEBUG Configuration:1185 - hibernate.use_outer_join=true
16:10:23,477 DEBUG Configuration:1185 - hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
16:10:23,478 DEBUG Configuration:1380 - null<-org.dom4j.tree.DefaultAttribute@14a8cd1 [Attribute: name resource value "mapping.hbm.xml"]
16:10:23,479 INFO Configuration:439 - Mapping resource: mapping.hbm.xml
16:10:23,480 DEBUG DTDEntityResolver:42 - trying to locate http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/
16:10:23,481 DEBUG DTDEntityResolver:53 - found http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath
16:10:23,647 INFO HbmBinder:256 - Mapping class: database -> DATABASES
16:10:23,656 DEBUG HbmBinder:1086 - Mapped property: name -> NAME
16:10:23,674 DEBUG HbmBinder:1086 - Mapped property: url -> URL
16:10:23,676 DEBUG HbmBinder:1086 - Mapped property: username -> USERNAME
16:10:23,677 DEBUG HbmBinder:1086 - Mapped property: password -> PASSWORD
16:10:23,677 DEBUG HbmBinder:1086 - Mapped property: schema -> SCHEMA
16:10:23,678 INFO Configuration:1340 - Configured SessionFactory: null
16:10:23,679 DEBUG Configuration:1341 - properties: {hibernate.connection.password=test01, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, sun.boot.library.path=/usr/lib/SunJava2-1.4.2/jre/lib/i386, java.vm.version=1.4.2_06-b03, hibernate.connection.username=devtest01, 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=unknown, java.vm.specification.name=Java Virtual Machine Specification, user.dir=/home/jos/workspace/Hibernate3XMLTest, java.runtime.version=1.4.2_06-b03, java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment, java.endorsed.dirs=/usr/lib/SunJava2-1.4.2/jre/lib/endorsed, os.arch=i386, java.io.tmpdir=/tmp, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., os.name=Linux, sun.java2d.fontpath=, java.library.path=/usr/lib/SunJava2-1.4.2/jre/lib/i386/client:/usr/lib/SunJava2-1.4.2/jre/lib/i386:/usr/lib/SunJava2-1.4.2/jre/../lib/i386:/opt/dbxml/lib:/usr/local/lib:/home/jos/programs/local/lib:/usr/lib/oracle/10.1.0.2/client/lib:/opt/dbxml/lib:/usr/local/lib:/home/jos/programs/local/lib:/usr/lib/oracle/10.1.0.2/client/lib:, java.specification.name=Java Platform API Specification, java.class.version=48.0, hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory, java.util.prefs.PreferencesFactory=java.util.prefs.FileSystemPreferencesFactory, os.version=2.6.5-7.147-smp, user.home=/home/jos, user.timezone=Europe/Berlin, java.awt.printerjob=sun.print.PSPrinterJob, file.encoding=UTF-8, java.specification.version=1.4, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, user.name=jos, java.class.path=/home/jos/workspace/Hibernate3XMLTest/bin:/home/jos/workspace/Hibernate3XMLTest/lib/ant-1.6.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/ant-antlr-1.6.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/ant-junit-1.6.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/ant-launcher-1.6.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/antlr-2.7.4.jar:/home/jos/workspace/Hibernate3XMLTest/lib/ant-swing-1.6.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/c3p0-0.8.5.jar:/home/jos/workspace/Hibernate3XMLTest/lib/cglib-full-2.0.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/cleanimports.jar:/home/jos/workspace/Hibernate3XMLTest/lib/commons-collections-2.1.1.jar:/home/jos/workspace/Hibernate3XMLTest/lib/commons-logging-1.0.4.jar:/home/jos/workspace/Hibernate3XMLTest/lib/concurrent-1.3.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/connector.jar:/home/jos/workspace/Hibernate3XMLTest/lib/dom4j-1.5.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/ehcache-1.1.jar:/home/jos/workspace/Hibernate3XMLTest/lib/hibernate3.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jaas.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jacc-1_0-fr.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jaxen-1.1-beta-4.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jboss-cache.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jboss-common.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jboss-jmx.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jboss-remoting.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jboss-system.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jdbc2_0-stdext.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jgroups-2.2.7.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jta.jar:/home/jos/workspace/Hibernate3XMLTest/lib/junit-3.8.1.jar:/home/jos/workspace/Hibernate3XMLTest/lib/log4j-1.2.9.jar:/home/jos/workspace/Hibernate3XMLTest/lib/oscache-2.1.jar:/home/jos/workspace/Hibernate3XMLTest/lib/proxool-0.8.3.jar:/home/jos/workspace/Hibernate3XMLTest/lib/swarmcache-1.0rc2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/versioncheck.jar:/home/jos/workspace/Hibernate3XMLTest/lib/xerces-2.6.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/xml-apis.jar:/home/jos/workspace/Hibernate3XMLTest/lib/ojdbc14.jar, hibernate.show_sql=false, java.vm.specification.version=1.0, java.home=/usr/lib/SunJava2-1.4.2/jre, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.OracleDialect, hibernate.connection.url=jdbc:oracle:thin:@svr10:1521:GENRE02, user.language=en, java.specification.vendor=Sun Microsystems Inc., hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, java.version=1.4.2_06, java.ext.dirs=/usr/lib/SunJava2-1.4.2/jre/lib/ext, sun.boot.class.path=/usr/lib/SunJava2-1.4.2/jre/lib/rt.jar:/usr/lib/SunJava2-1.4.2/jre/lib/i18n.jar:/usr/lib/SunJava2-1.4.2/jre/lib/sunrsasign.jar:/usr/lib/SunJava2-1.4.2/jre/lib/jsse.jar:/usr/lib/SunJava2-1.4.2/jre/lib/jce.jar:/usr/lib/SunJava2-1.4.2/jre/lib/charsets.jar:/usr/lib/SunJava2-1.4.2/jre/classes, java.vendor=Sun Microsystems Inc., file.separator=/, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, hibernate.use_outer_join=true, sun.cpu.isalist=}
16:10:23,681 DEBUG Configuration:1035 - Preparing to build session factory with filters : {}
16:10:23,682 INFO Configuration:844 - processing extends queue
16:10:23,682 INFO Configuration:848 - processing collection mappings
16:10:23,683 INFO Configuration:857 - processing association property references
16:10:23,683 INFO Configuration:884 - processing foreign key constraints
16:10:23,901 INFO Dialect:89 - Using dialect: org.hibernate.dialect.OracleDialect
16:10:23,910 DEBUG SQLExceptionConverterFactory:52 - Using dialect defined converter
16:10:23,925 INFO SettingsFactory:90 - Default batch fetch size: 1
16:10:23,926 INFO SettingsFactory:94 - Generate SQL with comments: disabled
16:10:23,927 INFO SettingsFactory:98 - Order SQL updates by primary key: disabled
16:10:23,928 INFO SettingsFactory:273 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
16:10:23,936 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTranslatorFactory
16:10:23,940 INFO SettingsFactory:106 - Query language substitutions: {}
16:10:23,947 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
16:10:23,948 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20
16:10:23,948 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
16:10:23,968 INFO DriverManagerConnectionProvider:80 - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@svr10:1521:GENRE02
16:10:23,969 INFO DriverManagerConnectionProvider:83 - connection properties: {user=devtest01, password=test01}
16:10:23,970 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
16:10:23,970 DEBUG DriverManagerConnectionProvider:109 - opening new JDBC connection
16:10:24,401 DEBUG DriverManagerConnectionProvider:115 - created connection to: jdbc:oracle:thin:@svr10:1521:GENRE02, Isolation Level: 2
16:10:24,411 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1
16:10:24,411 INFO SettingsFactory:148 - JDBC batch size: 15
16:10:24,412 INFO SettingsFactory:151 - JDBC batch updates for versioned data: disabled
16:10:24,414 INFO SettingsFactory:156 - Scrollable result sets: enabled
16:10:24,414 DEBUG SettingsFactory:160 - Wrap result sets: disabled
16:10:24,415 INFO SettingsFactory:164 - JDBC3 getGeneratedKeys(): disabled
16:10:24,419 INFO TransactionFactoryFactory:34 - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
16:10:24,424 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
16:10:24,425 INFO SettingsFactory:176 - Automatic flush during beforeCompletion(): disabled
16:10:24,425 INFO SettingsFactory:179 - Automatic session close at end of transaction: disabled
16:10:24,426 INFO SettingsFactory:260 - Cache provider: org.hibernate.cache.EhCacheProvider
16:10:24,432 INFO SettingsFactory:187 - Second-level cache: enabled
16:10:24,432 INFO SettingsFactory:192 - Optimize cache for minimal puts: disabled
16:10:24,433 INFO SettingsFactory:199 - Structured second-level cache entries: enabled
16:10:24,434 INFO SettingsFactory:203 - Query cache: disabled
16:10:24,434 INFO SettingsFactory:214 - Statistics: disabled
16:10:24,435 INFO SettingsFactory:218 - Deleted entity synthetic identifier rollback: disabled
16:10:24,436 INFO SettingsFactory:232 - Default entity-mode: pojo
16:10:24,692 INFO SessionFactoryImpl:140 - building session factory
16:10:24,696 DEBUG SessionFactoryImpl:149 - Session factory constructed with filter configurations : {}
16:10:24,696 DEBUG SessionFactoryImpl:152 - instantiating session factory with properties: {hibernate.connection.password=test01, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, sun.boot.library.path=/usr/lib/SunJava2-1.4.2/jre/lib/i386, java.vm.version=1.4.2_06-b03, hibernate.connection.username=devtest01, 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=unknown, java.vm.specification.name=Java Virtual Machine Specification, user.dir=/home/jos/workspace/Hibernate3XMLTest, java.runtime.version=1.4.2_06-b03, java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment, java.endorsed.dirs=/usr/lib/SunJava2-1.4.2/jre/lib/endorsed, os.arch=i386, java.io.tmpdir=/tmp, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., os.name=Linux, sun.java2d.fontpath=, java.library.path=/usr/lib/SunJava2-1.4.2/jre/lib/i386/client:/usr/lib/SunJava2-1.4.2/jre/lib/i386:/usr/lib/SunJava2-1.4.2/jre/../lib/i386:/opt/dbxml/lib:/usr/local/lib:/home/jos/programs/local/lib:/usr/lib/oracle/10.1.0.2/client/lib:/opt/dbxml/lib:/usr/local/lib:/home/jos/programs/local/lib:/usr/lib/oracle/10.1.0.2/client/lib:, java.specification.name=Java Platform API Specification, java.class.version=48.0, hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory, java.util.prefs.PreferencesFactory=java.util.prefs.FileSystemPreferencesFactory, os.version=2.6.5-7.147-smp, user.home=/home/jos, user.timezone=Europe/Berlin, java.awt.printerjob=sun.print.PSPrinterJob, file.encoding=UTF-8, java.specification.version=1.4, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, user.name=jos, java.class.path=/home/jos/workspace/Hibernate3XMLTest/bin:/home/jos/workspace/Hibernate3XMLTest/lib/ant-1.6.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/ant-antlr-1.6.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/ant-junit-1.6.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/ant-launcher-1.6.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/antlr-2.7.4.jar:/home/jos/workspace/Hibernate3XMLTest/lib/ant-swing-1.6.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/c3p0-0.8.5.jar:/home/jos/workspace/Hibernate3XMLTest/lib/cglib-full-2.0.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/cleanimports.jar:/home/jos/workspace/Hibernate3XMLTest/lib/commons-collections-2.1.1.jar:/home/jos/workspace/Hibernate3XMLTest/lib/commons-logging-1.0.4.jar:/home/jos/workspace/Hibernate3XMLTest/lib/concurrent-1.3.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/connector.jar:/home/jos/workspace/Hibernate3XMLTest/lib/dom4j-1.5.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/ehcache-1.1.jar:/home/jos/workspace/Hibernate3XMLTest/lib/hibernate3.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jaas.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jacc-1_0-fr.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jaxen-1.1-beta-4.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jboss-cache.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jboss-common.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jboss-jmx.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jboss-remoting.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jboss-system.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jdbc2_0-stdext.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jgroups-2.2.7.jar:/home/jos/workspace/Hibernate3XMLTest/lib/jta.jar:/home/jos/workspace/Hibernate3XMLTest/lib/junit-3.8.1.jar:/home/jos/workspace/Hibernate3XMLTest/lib/log4j-1.2.9.jar:/home/jos/workspace/Hibernate3XMLTest/lib/oscache-2.1.jar:/home/jos/workspace/Hibernate3XMLTest/lib/proxool-0.8.3.jar:/home/jos/workspace/Hibernate3XMLTest/lib/swarmcache-1.0rc2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/versioncheck.jar:/home/jos/workspace/Hibernate3XMLTest/lib/xerces-2.6.2.jar:/home/jos/workspace/Hibernate3XMLTest/lib/xml-apis.jar:/home/jos/workspace/Hibernate3XMLTest/lib/ojdbc14.jar, hibernate.show_sql=false, java.vm.specification.version=1.0, java.home=/usr/lib/SunJava2-1.4.2/jre, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.OracleDialect, hibernate.connection.url=jdbc:oracle:thin:@svr10:1521:GENRE02, user.language=en, java.specification.vendor=Sun Microsystems Inc., hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, java.version=1.4.2_06, java.ext.dirs=/usr/lib/SunJava2-1.4.2/jre/lib/ext, sun.boot.class.path=/usr/lib/SunJava2-1.4.2/jre/lib/rt.jar:/usr/lib/SunJava2-1.4.2/jre/lib/i18n.jar:/usr/lib/SunJava2-1.4.2/jre/lib/sunrsasign.jar:/usr/lib/SunJava2-1.4.2/jre/lib/jsse.jar:/usr/lib/SunJava2-1.4.2/jre/lib/jce.jar:/usr/lib/SunJava2-1.4.2/jre/lib/charsets.jar:/usr/lib/SunJava2-1.4.2/jre/classes, java.vendor=Sun Microsystems Inc., file.separator=/, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, hibernate.use_outer_join=true, sun.cpu.isalist=}
16:10:24,716 WARN Configurator:126 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/home/jos/workspace/Hibernate3XMLTest/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
16:10:24,939 DEBUG BasicEntityPersister:2191 - Static SQL for entity: database
16:10:24,939 DEBUG BasicEntityPersister:2193 - Version select: select NAME from DATABASES where NAME =?
16:10:24,943 DEBUG BasicEntityPersister:2194 - Snapshot select: select database_.NAME, database_.URL as URL0_, database_.USERNAME as USERNAME0_, database_.PASSWORD as PASSWORD0_, database_.SCHEMA as SCHEMA0_ from DATABASES database_ where database_.NAME=?
16:10:24,943 DEBUG BasicEntityPersister:2196 - Insert 0: insert into DATABASES (URL, USERNAME, PASSWORD, SCHEMA, NAME) values (?, ?, ?, ?, ?)
16:10:24,943 DEBUG BasicEntityPersister:2197 - Update 0: update DATABASES set URL=?, USERNAME=?, PASSWORD=?, SCHEMA=? where NAME=?
16:10:24,944 DEBUG BasicEntityPersister:2198 - Delete 0: delete from DATABASES where NAME=?
16:10:24,988 DEBUG EntityLoader:118 - Static select for entity database: select database0_.NAME as NAME0_, database0_.URL as URL0_0_, database0_.USERNAME as USERNAME0_0_, database0_.PASSWORD as PASSWORD0_0_, database0_.SCHEMA as SCHEMA0_0_ from DATABASES database0_ where database0_.NAME=?
16:10:24,989 DEBUG EntityLoader:118 - Static select for entity database: select database0_.NAME as NAME0_, database0_.URL as URL0_0_, database0_.USERNAME as USERNAME0_0_, database0_.PASSWORD as PASSWORD0_0_, database0_.SCHEMA as SCHEMA0_0_ from DATABASES database0_ where database0_.NAME=?
16:10:24,991 DEBUG EntityLoader:118 - Static select for entity database: select database0_.NAME as NAME0_, database0_.URL as URL0_0_, database0_.USERNAME as USERNAME0_0_, database0_.PASSWORD as PASSWORD0_0_, database0_.SCHEMA as SCHEMA0_0_ from DATABASES database0_ where database0_.NAME=? for update
16:10:24,992 DEBUG EntityLoader:118 - Static select for entity database: select database0_.NAME as NAME0_, database0_.URL as URL0_0_, database0_.USERNAME as USERNAME0_0_, database0_.PASSWORD as PASSWORD0_0_, database0_.SCHEMA as SCHEMA0_0_ from DATABASES database0_ where database0_.NAME=? for update nowait
16:10:24,996 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
16:10:24,999 DEBUG SessionFactoryObjectFactory:76 - registered: 12eb59f0027d911d01027d911ee00000 (unnamed)
16:10:25,000 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
16:10:25,000 DEBUG SessionFactoryImpl:249 - instantiated session factory
16:10:25,001 INFO SessionFactoryImpl:366 - Checking 0 named queries
16:10:25,051 DEBUG SessionImpl:229 - opened session
16:10:25,052 DEBUG SessionImpl:198 - opened session [dom4j]
16:10:25,055 DEBUG JDBCTransaction:46 - begin
16:10:25,055 DEBUG AbstractBatcher:379 - opening JDBC connection
16:10:25,056 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
16:10:25,056 DEBUG DriverManagerConnectionProvider:99 - using pooled JDBC connection, pool size: 0
16:10:25,056 DEBUG JDBCTransaction:50 - current autocommit status: false
16:10:25,062 DEBUG DefaultSaveOrUpdateEventListener:159 - saving transient instance
Exception in thread "main" 16:10:25,068 DEBUG JDBCContext:247 - running Session.finalize()
16:10:25,069 WARN JDBCContext:250 - afterTransactionCompletion() was never called
16:10:25,069 WARN JDBCContext:259 - unclosed connection, forgot to call close() on your session?
Code:
Code:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 07, 2005 9:28 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
The last bit should be:

Code:
dom4jSession.save("database", db);
...


Top
 Profile  
 
 Post subject: or course
PostPosted: Tue Mar 08, 2005 4:59 am 
Newbie

Joined: Thu Jan 20, 2005 9:12 am
Posts: 4
steve wrote:
The last bit should be:

Code:
dom4jSession.save("database", db);
...


Thanks, Steve!
you're right, I was using the wrong Session object.
In fact,
Code:
dom4jSession.save(db);

works fine too.

Is there a special reason, that one needs two Session objects? It's rather confusing. I'd prefer code like:
Code:
Session session = factory.openSession(EntityMode.DOM4J);
Transaction tx = session.beginTransaction();
...
tx.commit();
session.close();


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 08, 2005 11:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
LOL. We just had this discussion a few days ago.

The reason for not having the ability to specify in which entity mode to open the session from the factory is that SessionFactory.openSession() is overloaded to allow a number of various parameters. Adding the ability to specify an entity mode on top of all that would mean an explosion of those openSession() methods.

If you are only working with dom4j data, you can use the hibernate.default_entity_mode setting which determines the entity mode for the initial session obtained from the factory.


Top
 Profile  
 
 Post subject: session instationation
PostPosted: Tue Mar 08, 2005 11:42 am 
Newbie

Joined: Thu Jan 20, 2005 9:12 am
Posts: 4
steve wrote:
LOL. We just had this discussion a few days ago.

The reason for not having the ability to specify in which entity mode to open the session from the factory is that SessionFactory.openSession() is overloaded to allow a number of various parameters. Adding the ability to specify an entity mode on top of all that would mean an explosion of those openSession() methods.

If you are only working with dom4j data, you can use the hibernate.default_entity_mode setting which determines the entity mode for the initial session obtained from the factory.


I'm planning to mix use of the different types of sessions, so the hibernate.default_entity_mode is not an option. I see that the allowed openSession parameters cannot be used after instantiation, so it's not possible to remove any functions with parameters that could be added later. What you could do however, is to allow for null values. E.g.
Code:
openSession(EntityMode em, Connection c, Interceptor i);

and use the default value for every parameter that has value null. I guess some people would find this an ugly solution, however.
The confusion of having nested session is, in my opinion, considerable and it would be nice if it could be avoided.

Cheers, Jos


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 08, 2005 11:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
I hear you.

We definitely want something different here; but the best how to acheive that is still being determined. If you have any suggestions after using this for a bit please let us know (though it will not include nullable parameters ;)


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.