• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Entity must be managed to call remove

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am facing a very common problem. I am not able to remove an entity from datatable. My entity class is:



My Dao class is:





My service class is:



And my spring-config xml file is:



What can be the reason behind this error:

Entity must be managed to call remove: com.infosys.ingreen.middleware.entity.ElectricDeviceEntity@908881, try merging the detached and try the remove again.

 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you get as the deviceEntity in the method? Perhaps you can try some changes to the entity in the memory then call deleteDevice() method to see whether you get the entity from the DB after the call to merge()?
 
Kshitiz Agarwal
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vijitha Kumara wrote:What you get as the deviceEntity in the method? Perhaps you can try some changes to the entity in the memory then call deleteDevice() method to see whether you get the entity from the DB after the call to merge()?



I have checked that...even what I have searched that entity in deleteDeviceDao class and then remove that found entity. But again the same error is coming. I dont know why the entity is not managed entity here?
 
Kshitiz Agarwal
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vijitha Kumara wrote:What you get as the deviceEntity in the method? Perhaps you can try some changes to the entity in the memory then call deleteDevice() method to see whether you get the entity from the DB after the call to merge()?



When I tried the following change:


@Repository
@Component




The error comes is:

Exception Description: No transaction is currently active



Please help me....any suggestion??
 
Wait for it ... wait .... wait .... NOW! Pafiffle! A perfect tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic