Hibernate version:
hibernate-2.1
Mapping documents:
<?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="com.a2suite.domain.model.OnlineOrder"
table="ONLINE_ORDER"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="orderNumber"
column="ORDER_NO"
type="int"
>
<generator class="sequence">
</generator>
</id>
<property
name="memberNumber"
type="int"
update="true"
insert="true"
column="MEMBER_NO"
not-null="true"
/>
<property
name="totalMoney"
type="int"
update="true"
insert="true"
column="TOTAL_MONEY"
not-null="true"
/>
<property
name="totalTax"
type="int"
update="true"
insert="true"
column="TOTAL_TAX"
not-null="true"
/>
<property
name="orderDay"
type="java.sql.Timestamp"
update="true"
insert="true"
column="ORDER_DAY"
not-null="true"
/>
<property
name="collectNumber"
type="java.lang.String"
update="true"
insert="true"
column="COLLECT_NO"
length="16"
/>
<property
name="lastUpdateDay"
type="java.sql.Timestamp"
update="true"
insert="true"
column="LAST_UPD_DAY"
not-null="false"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-OnlineOrder.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
Postgres 7.1
Debug level Hibernate log excerpt:
I have a table name Online_Order, with primary key order_no, and also a Unique column name, collect_no. I try to set It increment in order_no then, it works. What I want to do is to set the unique collect_no column in this format YYYYMMDD-XXXXX, which YYYYMMDD is no problem. but the XXXXX part will be like this 00001, 00002, .... every time data is inserted in this table. the XXXXX part will increment. I try to set collect_no to be the id param, but It didnt allow. Then It is possible to first set the order_no primary key that will evaluate the XXXXX part, then get the value of it to be assign in colect_no?
I am not sure how? any help would be greatly appreciated!
Thanks!
_________________ yuubouna
|