Hey,
I am using the hilo generator. When I ask the service layer to add an item the hilo counter gets incremented, however there is no new record.
I guess I'm thrown by the fact that there is no exception. I was getting good at resolving those :) Thanks for any pointers,
Amir
Hibernate version: 2
Mapping documents: Submission.hbm.xml:
Code:
<?xml version="1.0"?>
<!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.mathforum.pow.model.Submission" table="amir" >
<id name="submissionId" column="amir_id" type="java.lang.Long" unsaved-value="0">
<generator class="hilo">
<param name="table">hibernate_unique_key</param>
<param name="column">next_hi</param>
<param name="max_lo">1</param>
</generator>
</id>
<property name="shortSolution" column="amir_text1" type="java.lang.String" />
<property name="longSolution" column="amir_text2" type="java.lang.String" />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
try {
System.err.println("DEBUG ADT: SubmissionId: " + Submission.getSubmissionId());
System.err.println("DEBUG ADT: short: " + Submission.getShortSolution());
System.err.println("DEBUG ADT: long: " + Submission.getLongSolution());
session.save(Submission);
session.flush();
} catch (HibernateException he) {
System.err.println("DEBUG ADT: Hibernate exception: " + he.getMessage() + he);
log.error("Hibernate exception: " + he.getMessage());
throw new RuntimeException(he);
} finally {
if (session != null) {
try {
session.close();
} catch (HibernateException he) {
log.error("Hibernate exception: " + he.getMessage());
throw new RuntimeException(he);
}
}
log.debug("leaving Submission.addSubmission");
}
Full stack trace of any exception that occurs: no exceptions
Name and version of the database you are using: postgres 7.3
The generated SQL (show_sql=true): Hibernate: insert into amir (amir_text1, amir_text2, amir_id) values (?, ?, ?)
Debug level Hibernate log excerpt: (how do I get hibernate to log at a debug level?) other debug output:
Quote:
DEBUG ADT: entering Submission.addSubmission
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@10e6cbd [ connectionPool
DataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@1f60430 [ acquireIncremen
t -> 1, autoCommitOnClose -> false, connectionTesterClassName -> com.mchange.v2.c3p0.impl.D
efaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions ->
false, idleConnectionTestPeriod -> 0, initialPoolSize -> 2, maxIdleTime -> 5000, maxPoolSiz
e -> 100, maxStatements -> 100, minPoolSize -> 2, nestedDataSource -> com.mchange.v2.c3p0.D
riverManagerDataSource@52c6f [ description -> null, driverClass -> null, factoryClassLocati
on -> null, jdbcUrl -> jdbc:postgresql://xxxx.xxxxx.org:5432/xxxxx, properties -> {user
=xxxxx, password=xxxxx} ] , propertyCycle -> 300, testConnectionOnCheckout -> false ] , f
actoryClassLocation -> null, numHelperThreads -> 3 ]
DEBUG ADT: SubmissionId: null
DEBUG ADT: short: hard coded string
DEBUG ADT: long: hard coded string
Hibernate: insert into amir (amir_text1, amir_text2, amir_id) values (?, ?, ?)
the sql for the table is:
Code:
CREATE TABLE amir
(
amir_id int8 NOT NULL,
amir_text1 varchar(50) NOT NULL,
amir_text2 varchar(50) NOT NULL
)
WITH OIDS;
ALTER TABLE amir OWNER TO amir;