Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Purchase Order > HibernateException: Illegal attempt to associate a collection with two open sessions #50

Closed
jmiranda opened this issue Mar 30, 2015 · 1 comment
Assignees
Labels
type: bug Addresses unintended behaviours of the app
Milestone

Comments

@jmiranda
Copy link
Member

Reported by Jesse Paulsen ([email protected]):

Stacktrace:

Error 500: 
Servlet: 
URI: 
Exception Message: Illegal attempt to associate a collection with two open sessions 
Caused by: Exception thrown executing org.codehaus.groovy.grails.webflow.engine.builder.ClosureInvokingAction@25fa0c1c in state 'confirmOrderReceipt' of flow 'receiveOrderWorkflow/receiveOrder' -- action execution attributes were 'map[[empty]]' 
Class: ReceiveOrderWorkflowController 
At Line: [100] 
Code Snippet:
org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing org.codehaus.groovy.grails.webflow.engine.builder.ClosureInvokingAction@25fa0c1c in state 'confirmOrderReceipt' of flow 'receiveOrderWorkflow/receiveOrder' -- action execution attributes were 'map[[empty]]'
    at grails.plugin.springcache.web.GrailsFragmentCachingFilter.doFilter(GrailsFragmentCachingFilter.groovy:66)
    at net.sf.ehcache.constructs.web.filter.Filter.doFilter(Filter.java:86)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.orm.hibernate3.HibernateSystemException: Illegal attempt to associate a collection with two open sessions; nested exception is org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
    at org.pih.warehouse.inventory.InventoryService.findOrCreateInventoryItem(InventoryService.groovy:2040)
    at org.pih.warehouse.inventory.InventoryService$$FastClassByCGLIB$$a7f866ff.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.pih.warehouse.inventory.InventoryService$$EnhancerByCGLIB$$25941301.findOrCreateInventoryItem(<generated>)
    at org.pih.warehouse.inventory.InventoryService$findOrCreateInventoryItem.call(Unknown Source)
    at org.pih.warehouse.order.OrderService$_saveOrderShipment_closure3_closure10.doCall(OrderService.groovy:136)
    at $Proxy17.doInHibernate(Unknown Source)
    at org.pih.warehouse.order.OrderService$_saveOrderShipment_closure3.doCall(OrderService.groovy:135)
    at org.pih.warehouse.order.OrderService.saveOrderShipment(OrderService.groovy:126)
    at org.pih.warehouse.order.OrderService$$FastClassByCGLIB$$ca942d1b.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.pih.warehouse.order.OrderService$$EnhancerByCGLIB$$65f8d35.saveOrderShipment(<generated>)
    at org.pih.warehouse.order.OrderService$saveOrderShipment.call(Unknown Source)
    at org.pih.warehouse.order.ReceiveOrderWorkflowController$_closure2_closure6_closure13.doCall(ReceiveOrderWorkflowController.groovy:100)
    ... 3 more
Caused by: org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
    at $Proxy16.lock(Unknown Source)
    at $Proxy16.lock(Unknown Source)
    ... 17 more
@jmiranda jmiranda added the type: maintenance Code improvements, optimizations and refactors, dependency upgrades... label Sep 10, 2015
@jmiranda jmiranda added this to the 0.7.7 milestone Apr 7, 2016
@jmiranda jmiranda self-assigned this Apr 7, 2016
@jmiranda jmiranda added type: bug Addresses unintended behaviours of the app and removed type: maintenance Code improvements, optimizations and refactors, dependency upgrades... labels Apr 7, 2016
@jmiranda
Copy link
Member Author

jmiranda commented Apr 7, 2016

This occurs because we are using a different Hibernate session to find or create inventory items associated with the incoming stock. The inventory item cannot be associated with both sessions at the same time. It might be as easy as flushing the temporary session, but I need to investigate further.

@jmiranda jmiranda mentioned this issue Apr 22, 2016
jmiranda added a commit that referenced this issue Apr 28, 2016
* minor cleanup to prevent the assign identifier quartz job from throwing hundreds of "Duplicate key" errors if the pool of identifiers is small enough to cause lots of collisions

* removed unnecessarily verbose logging from inventory service

* Purchase Order UI changes to make it more consistent with other pages

* fixed #133: added ability to import order line items into an existing order; also added rollback feature

* fixed #50: Illegal attempt to associate a collection with two open sessions when receiving against purchase order

* Minor enhancements to make UI a little more consistent across entire app

* bumped app version to 0.7.8

* removed annoying inventory sampling report constraint
jmiranda added a commit that referenced this issue May 10, 2016
* Hotfix 0.7.8 (#141)

* minor cleanup to prevent the assign identifier quartz job from throwing hundreds of "Duplicate key" errors if the pool of identifiers is small enough to cause lots of collisions

* removed unnecessarily verbose logging from inventory service

* Purchase Order UI changes to make it more consistent with other pages

* fixed #133: added ability to import order line items into an existing order; also added rollback feature

* fixed #50: Illegal attempt to associate a collection with two open sessions when receiving against purchase order

* Minor enhancements to make UI a little more consistent across entire app

* bumped app version to 0.7.8

* removed annoying inventory sampling report constraint

* fixed #89: made significant performances improvements to the dashboard

* Removed errant text that was committed by accident

* Hotfix/62 missing foreign key constraints (#145)

* added missing primary keys and foreign key constraints to several tables (fixed #62, #108)
* bumped app version to 0.7.9

* Fixed unit test for the show inventory report feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Addresses unintended behaviours of the app
Projects
None yet
Development

No branches or pull requests

1 participant