Announcement Announcement Module
No announcement yet.
Hibernate + Spring -> NonUniqueObjectException Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate + Spring -> NonUniqueObjectException

    i have a testing application with a Struts Action that uses a proxied bean with transaction demarcation and works fine. The Action object simply creates some persistent objects.

    The problem arrises when that Action is invoked by two (or more) simultaneous clients. In this case i get a NonUniqueObjectException. I think it's probably because the proxy i get from the factory is a singleton associated to the same Session for both requests, but i can't set de singleton property to false in TransactionProxyFactoryBean.

    Can someone help me with this issue?

    Thanks in advance

  • #2
    Hi again, i think i have the problem fixed.
    The action object was using a SequenceDao to generate de IDs for the new rows in the DB from the values in a Sequence table (with sequenceName=value pairs where sequenceName is TABLE_NAME.ID_FIELD_NAME).
    The problem was that the DAO was not flushing the Session before the other Thread entered the mutex block and made a SELECT to get the next sequence value.

    I hope this helps other people with the same 'programming' problem i had. If not... this message is nothing but useless.