Okay -- I have pretty much read the manning book, went through all the examples noted in the roadmap -- SERIOUSLY! So I think "hey - let me actually get one of these to work on JBoss" -- big freakin mistake
I have been at it now for 2 days trying on and off to get this thing to work.
What in the world is wrong??? Any help is appreciated -- this should be simple shouldn't it?
JBoss mysql ds file - although this should not matter because i put the connection url in my hibernate.properties
<datasources>
<local-tx-datasource>
<jndi-name>mysqlTest</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/test</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password/>
</local-tx-datasource>
</datasources>
Hibernate version:2.1.6
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping.dtd">
<hibernate-mapping>
<class name="com.dbdemo.User" table="users">
<id name="ID" column="LogonId" type="string">
<generator class="assigned"/>
</id>
<property name="userName" column="Name" type="string"/>
<property name="password" type="string"/>
<property name="emailAddress" type="string"/>
<property name="lastLogon" type="date"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Configuration cfg = new Configuration();
cfg.addResource("com/dbdemo/User.hbm.xml");
cfg.setProperties(System.getProperties());
SessionFactory sessionsFact = cfg.buildSessionFactory();
System.out.println("Session Factory built");
Session session = sessionsFact.openSession();
System.out.println("Session built");
session.save(newUser);
System.out.println("User saved");
session.flush();
System.out.println("Session flushed");
session.close();
Full stack trace of any exception that occurs:
20:37:00,858 INFO [Environment] Hibernate 2.1.6
20:37:00,862 INFO [Environment] loaded properties from resource hibernate.properties: {hibernate.connection.username=root, hibernate.connection.password=, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.connection.url=jdbc:mysql://localhost:3306/test, hibernate.connection.driver_class=org.gjt.mm.mysql.Driver}
20:37:00,868 INFO [Environment] using CGLIB reflection optimizer
20:37:00,879 INFO [Configuration] Mapping resource: com/dbdemo/User.hbm.xml
20:37:01,816 INFO [Binder] Mapping class: com.dbdemo.User -> users
20:37:02,090 INFO [Configuration] processing one-to-many association mappings
20:37:02,092 INFO [Configuration] processing one-to-one association property references
20:37:02,093 INFO [Configuration] processing foreign key constraints
20:37:02,179 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.MySQLDialect
20:37:02,189 INFO [SettingsFactory] Maximim outer join fetch depth: 2
20:37:02,192 INFO [SettingsFactory] Use outer join fetching: true
20:37:02,207 WARN [UserSuppliedConnectionProvider] No connection properties specified - the user must supply JDBC connections
20:37:02,223 INFO [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
20:37:02,224 INFO [SettingsFactory] Use scrollable result sets: false
20:37:02,225 INFO [SettingsFactory] Use JDBC3 getGeneratedKeys(): false
20:37:02,226 INFO [SettingsFactory] Optimize cache for minimal puts: false
20:37:02,228 INFO [SettingsFactory] Query language substitutions: {}
20:37:02,229 INFO [SettingsFactory] cache provider: net.sf.hibernate.cache.EhCacheProvider
20:37:02,264 INFO [Configuration] instantiating and configuring caches
20:37:02,683 INFO [SessionFactoryImpl] building session factory
20:37:03,292 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
20:37:03,294 INFO [STDOUT] Session Factory built
20:37:03,449 INFO [STDOUT] Session built
20:37:03,478 INFO [STDOUT] User saved
20:37:03,522 INFO [STDOUT] XXXXXXXX caught throwable The user must supply a JDBC connection
Name and version of the database you are using:
mysql - 4.0.20
Debug level Hibernate log excerpt:
|