I have solved your issue by having stored procedure to return the records.
This stored procedure use select for update with row lock. When JPA consumer
calls the stored procedures it will guarantee to call next set of records
rather than the records that have been locked by other JPA consumer. It is
messy to get application to manage this. This way, it will also to allow 3
or 4 or n number of consumers..
In the entity class, i have used Hibernate Query hint. ( We use Sybase
database)
@NamedNativeQueries({ @NamedNativeQuery(name="pollRecords", query="SET
CHAINED OFF exec poll_record_process 2500",
resultClass= MyEntity.class,
hint...@queryhint(name="org.hibernate.callable",
value="true")}),
@NamedNativeQuery(name="pollRecordsTest", query="SET CHAINED OFF exec
poll_record_procTest 10",
resultClass= MyEntity.class,
hint...@queryhint(name="org.hibernate.callable",
value="true")})
})
--
View this message in context:
http://camel.465427.n5.nabble.com/Multiple-JPA-Consumers-tp472290p3266637.html
Sent from the Camel - Users mailing list archive at Nabble.com.