Hi there
I use increment for id generator for Postgresql 7.4 ...
Hibernate version is 2.1.6
My application is a desktop one. 4-5 clients are using the application
via network sharing. I mean they run same files from a sharing server.
After some insertions, i am getting the following duplicate key error..
Is there anyone who encountered this problem? can sharing method be the problem? Thanx in advance...
2005-01-15 11:40:42,279 [main] ERROR hibernate.util.JDBCExceptionReporter(46) -> ERROR: duplicate key violates unique constraint "turq_inventory_transactions_pkey"
2005-01-15 11:40:42,279 [main] ERROR hibernate.util.JDBCExceptionReporter(38) -> Could not execute JDBC batch update
Batch entry 0 insert into turq_inventory_transactions (transactions_amount_in, transactions_unit_price, transactions_total_price, transactions_discount, transactions_discount_amount, transactions_vat, transactions_vat_amount, transactions_vat_special_each, transactions_vat_special, transactions_vat_special_amount, transactions_cumilative_price, transactions_total_amount_out, created_by, creation_date, updated_by, last_modified, transactions_date, inventory_warehouses_id, inventory_units_id, engine_sequences_id, inventory_cards_id, inventory_transactions_id) values ( was aborted. Call getNextException() to see the cause.
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:108)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:118)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2311)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2261)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2187)
at com.turquaz.consignment.dal.ConDALAddConsignment.save(ConDALAddConsignment.java:40)
at
My Mapping file is the following..
<?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>
<!--
Created by the Middlegen Hibernate plugin 2.1
http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->
<class
name="com.turquaz.engine.dal.TurqInventoryTransaction"
table="turq_inventory_transactions"
>
<id
name="inventoryTransactionsId"
type="int"
column="inventory_transactions_id"
>
<generator class="increment" />
</id>
<property
name="transactionsAmountIn"
type="long"
column="transactions_amount_in"
not-null="true"
length="8"
/>
<property
name="transactionsUnitPrice"
type="java.math.BigDecimal"
column="transactions_unit_price"
not-null="true"
length="65535"
/>
<property
name="transactionsTotalPrice"
type="java.math.BigDecimal"
column="transactions_total_price"
not-null="true"
length="65535"
/>
<property
name="transactionsDiscount"
type="java.math.BigDecimal"
column="transactions_discount"
not-null="true"
length="65535"
/>
<property
name="transactionsDiscountAmount"
type="java.math.BigDecimal"
column="transactions_discount_amount"
not-null="true"
length="65535"
/>
<property
name="transactionsVat"
type="int"
column="transactions_vat"
not-null="true"
length="4"
/>
<property
name="transactionsVatAmount"
type="java.math.BigDecimal"
column="transactions_vat_amount"
not-null="true"
length="65535"
/>
<property
name="transactionsVatSpecialEach"
type="java.math.BigDecimal"
column="transactions_vat_special_each"
not-null="true"
length="65535"
/>
<property
name="transactionsVatSpecial"
type="java.math.BigDecimal"
column="transactions_vat_special"
not-null="true"
length="65535"
/>
<property
name="transactionsVatSpecialAmount"
type="java.math.BigDecimal"
column="transactions_vat_special_amount"
not-null="true"
length="65535"
/>
<property
name="transactionsCumilativePrice"
type="java.math.BigDecimal"
column="transactions_cumilative_price"
not-null="true"
length="65535"
/>
<property
name="transactionsTotalAmountOut"
type="long"
column="transactions_total_amount_out"
not-null="true"
length="8"
/>
<property
name="createdBy"
type="java.lang.String"
column="created_by"
not-null="true"
length="50"
/>
<property
name="creationDate"
type="java.sql.Date"
column="creation_date"
not-null="true"
length="4"
/>
<property
name="updatedBy"
type="java.lang.String"
column="updated_by"
not-null="true"
length="50"
/>
<property
name="lastModified"
type="java.sql.Date"
column="last_modified"
not-null="true"
length="4"
/>
<property
name="transactionsDate"
type="java.sql.Date"
column="transactions_date"
not-null="true"
length="4"
/>
<!-- Associations -->
<!-- bi-directional many-to-one association to TurqInventoryWarehous -->
<many-to-one
name="turqInventoryWarehous"
class="com.turquaz.engine.dal.TurqInventoryWarehous"
not-null="true"
>
<column name="inventory_warehouses_id" />
</many-to-one>
<!-- bi-directional many-to-one association to TurqInventoryUnit -->
<many-to-one
name="turqInventoryUnit"
class="com.turquaz.engine.dal.TurqInventoryUnit"
not-null="true"
>
<column name="inventory_units_id" />
</many-to-one>
<!-- bi-directional many-to-one association to TurqEngineSequence -->
<many-to-one
name="turqEngineSequence"
class="com.turquaz.engine.dal.TurqEngineSequence"
not-null="true"
>
<column name="engine_sequences_id" />
</many-to-one>
<!-- bi-directional many-to-one association to TurqInventoryCard -->
<many-to-one
name="turqInventoryCard"
class="com.turquaz.engine.dal.TurqInventoryCard"
not-null="true"
>
<column name="inventory_cards_id" />
</many-to-one>
</class>
</hibernate-mapping>