Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.2
Mapping documents:
<hibernate-mapping>
<meta attribute="generated-class">pojo.PaymentRequestBase</meta>
<meta attribute="scope-class">public abstract</meta>
<class name="pojo.model.PaymentRequest"
table="PAYMENT_REQUEST">
<id name="paymentRequestEid" type="long">
<column name="PAYMENT_REQUEST_EID" precision="20" scale="0" />
<generator class="assigned" />
</id>
<property name="orderId" type="string">
<column name="ORDER_ID" length="30" />
</property>
<property name="orderDate" type="timestamp">
<column name="ORDER_DATE" length="7" not-null="true" />
</property>
<property name="receiptNo" type="string">
<column name="RECEIPT_NO" length="30" />
</property>
<property name="createUserId" type="string">
<column name="CREATE_USER_ID" length="30" not-null="true" />
</property>
<property name="createDate" type="timestamp">
<column name="CREATE_DATE" length="7" not-null="true" />
</property>
<property name="updateUserId" type="string">
<column name="UPDATE_USER_ID" length="30" />
</property>
<property name="updateDate" type="timestamp">
<column name="UPDATE_DATE" length="7" />
</property>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Code:
try {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
query = session.createSQLQuery("select payment_request_seq.nextval from dual");
if (query != null && !query.list().isEmpty()) {
Iterator iter = query.list().iterator();
BigDecimal nextValue = (BigDecimal) iter.next();
value = nextValue.longValue();
}
} catch (HibernateException e) {
log.error("An error has occurred.", e);
handleException(e);
}
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html
Can someone please tell me why the following sql always returns a even number?
session.createSQLQuery("select payment_request_seq.nextval from dual");
Thanks.