You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by baluji <ja...@gmail.com> on 2009/11/18 08:34:44 UTC

Deleting a persistant object not resulting exception but not deleting the data from database table

   hi,


    I am trying delete a detached instance resulting 

    Caused by: java.lang.IllegalArgumentException: Removing a detached
instance

    I am making the object persistant by using the method

    emailerScheduler= this.findById(emailScheduler.getId());

    validating whether the object is persistant by using the following
method that returns true.

  
    getJpaTemplate().contains(emailerScheduler);


    and then removing the object 

   getJpaTemplate().remove(emailerScheduler);    

    this does not result any exception.But it does not result deletion of
the data from database.

   any help will be  appreciated.

Thanks

Balu

-- 
View this message in context: http://n2.nabble.com/Deleting-a-persistant-object-not-resulting-exception-but-not-deleting-the-data-from-database-table-tp4023833p4023833.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

RE: Deleting a persistant object not resulting exception but not deleting the data from database table

Posted by Michael Vorburger <mv...@odyssey-group.com>.
Balu,

Your description isn't very clear, your "making the object persistant"
using findById?!  and your remove() results in an
"IllegalArgumentException: Removing a detached instance" or "does not
result any exception" ?

If you ARE trying to do em.remove() on a detached entity, what may work
(I have not tried it) is to use a
getJpaTemplate().remove(getJpaTemplate().getReference(EmailerSchedulerEn
tity.class, emailerScheduler.getId())) kind of approach.

Regards.
 

-----Original Message-----
From: baluji [mailto:jaisha.b@gmail.com] 
Sent: Wednesday, November 18, 2009 8:35 AM
To: users@openjpa.apache.org
Subject: Deleting a persistant object not resulting exception but not
deleting the data from database table


   hi,


    I am trying delete a detached instance resulting 

    Caused by: java.lang.IllegalArgumentException: Removing a detached
instance

    I am making the object persistant by using the method

    emailerScheduler= this.findById(emailScheduler.getId());

    validating whether the object is persistant by using the following
method that returns true.

  
    getJpaTemplate().contains(emailerScheduler);


    and then removing the object 

   getJpaTemplate().remove(emailerScheduler);    

    this does not result any exception.But it does not result deletion
of the data from database.

   any help will be  appreciated.

Thanks

Balu

--
View this message in context:
http://n2.nabble.com/Deleting-a-persistant-object-not-resulting-exceptio
n-but-not-deleting-the-data-from-database-table-tp4023833p4023833.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

____________________________________________________________

� This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
� Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
� Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
� An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
� If you have received this email in error, please notify the sender immediately
  and delete the original.