Hello:
I'm sure this is something silly but I can not figure it out...any help will be greatly appreciated.
Hibernate version: 2.1.6
Mapping documents:
--conf.xml--
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- properties -->
<property name="connection.username">root</property>
<property name="connection.url">jdbc:mysql://localhost/comics</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.password"></property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.provider_class">net.sf.hibernate.connection.C3P0ConnectionProvider</property>
<property name="c3po.acquire_increment">1</property>
<property name="c3po.idle_test_period">100</property>
<property name="c3po.max_size">50</property>
<property name="c3po.max_statements">0</property>
<property name="c3po.min_size">10</property>
<!-- timeout in seconds -->
<property name="c3po.timeout">100</property>
<property name="hibernate.show_sql">true</property>
<!-- mapping files -->
<mapping resource="org/will/comics/model/Comic.hbm.xml"></mapping>
<mapping resource="org/will/comics/model/IssueType.hbm.xml"></mapping>
</session-factory>
</hibernate-configuration>
---mapping----
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
>
<class
name="org.will.comics.model.Comic"
table="comicbooks"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
>
<id
name="id"
column="id"
type="java.lang.Long"
unsaved-value="0"
>
<generator class="native">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-Comic.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<property
name="currentValue"
type="double"
update="true"
insert="true"
access="property"
column="current_value"
/>
<property
name="issueNumber"
type="int"
update="true"
insert="true"
access="property"
column="issue_number"
/>
<property
name="issueTypeID"
type="int"
update="true"
insert="true"
access="property"
column="issuetype_id"
/>
<property
name="nbrInMiniseries"
type="int"
update="true"
insert="true"
access="property"
column="nbr_in_miniseries"
/>
<property
name="pricelastmodifiedDate"
type="java.sql.Date"
update="true"
insert="true"
access="property"
column="pricelastmodified_date"
/>
<property
name="publicationDate"
type="java.sql.Date"
update="true"
insert="true"
access="property"
column="publication_date"
/>
<property
name="purchasePrice"
type="double"
update="true"
insert="true"
access="property"
column="purchase_price"
/>
<property
name="subtitle"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="subtitle"
/>
<property
name="title"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="title"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Comic.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
---mapping 2----
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
>
<class
name="org.will.comics.model.IssueType"
table="issuetypes"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
>
<id
name="id"
column="uid"
type="java.lang.Long"
>
<generator class="">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-IssueType.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<property
name="description"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="description"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-IssueType.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
public static Session currentSession() throws HibernateException {
Session session = (Session) threadLocal.get();
if (session == null) {
if (sessionFactory == null) {
try {
cfg.configure(CONFIG_FILE_LOCATION);
sessionFactory = cfg.buildSessionFactory();
}
catch (Exception e) {
System.err.println("%%%% Error Creating SessionFactory %%%%");
e.printStackTrace();
}
}
session = sessionFactory.openSession();
threadLocal.set(session);
}
return session;
}
public static void closeSession() throws HibernateException {
Session session = (Session) threadLocal.get();
threadLocal.set(null);
if (session != null) {
session.close();
}
}
Full stack trace of any exception that occurs:
dispatcher: org.apache.catalina.core.ApplicationDispatcher@1dacb2b
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@a8c19b [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@1127c4d [ acquireIncrement -> 1, autoCommitOnClose -> false, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 0, initialPoolSize -> 1, maxIdleTime -> 0, maxPoolSize -> 100, maxStatements -> 0, minPoolSize -> 1, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@13eb2bc [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> ...mysql props... ] , propertyCycle -> 300, testConnectionOnCheckout -> false ] , factoryClassLocation -> null, numHelperThreads -> 3 ]
%%%% Error Creating SessionFactory %%%%
net.sf.hibernate.MappingException: could not instantiate id generator
at net.sf.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:82)
at net.sf.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:82)
at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:630)
at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:714)
at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:42)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:137)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:768)
at org.will.comics.service.ComicSession.currentSession(ComicSession.java:51)
at org.will.comics.service.impl.ComicManagerImpl.<init>(ComicManagerImpl.java:33)
at org.will.comics.servlets.ComicServlet.init(ComicServlet.java:46)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:687)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:671)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:474)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:409)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
at org.will.comics.servlets.WebAppFrontController.dispatch(WebAppFrontController.java:123)
at org.will.comics.servlets.WebAppFrontController.processRequest(WebAppFrontController.java:106)
at org.will.comics.servlets.WebAppFrontController.doPost(WebAppFrontController.java:79)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.ClassNotFoundException:
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:102)
at net.sf.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:76)
... 45 more
Name and version of the database you are using:
MySQL 4.0.20
The generated SQL (show_sql=true):
...don't know where to find it...???...sorry
Debug level Hibernate log excerpt:
...don't know where to find it...???...sorry
_________________ Regards,
-Will
|