[ 
https://issues.apache.org/jira/browse/DELTASPIKE-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14151737#comment-14151737
 ] 

Loïc Prieto Dehennault commented on DELTASPIKE-734:
---------------------------------------------------

Hi there, Thomas. Thanks for taking the time to answer :)

I've verified each of the questions you've asked, and the results are:
{quote}
Which transaction strategy do you have in place? (see 
http://deltaspike.apache.org/documentation/jpa#_jta_support)
{quote}
We use 
org.apache.deltaspike.jpa.impl.transaction.*BeanManagedUserTransactionStrategy*,
 configured both in beans.xml, with the following code:
{code:xml}
<beans xmlns="http://java.sun.com/xml/ns/javaee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xsi:schemaLocation="
      http://java.sun.com/xml/ns/javaee 
      http://java.sun.com/xml/ns/javaee/beans_1_0.xsd";>
    <alternatives>
        
<class>org.apache.deltaspike.jpa.impl.transaction.BeanManagedUserTransactionStrategy</class>
    </alternatives>
    <decorators/>
    <interceptors>
        
<class>cat.tmb.tdo.ocicommerce.services.logger.LoggedInterceptorImpl</class>
        
<class>org.apache.deltaspike.security.impl.extension.SecurityInterceptor</class>
    </interceptors>
</beans>
{code}
and in apache-deltaspike.properties with the following code:
{code}
org.apache.deltaspike.ProjectStage=${cdi.project.stage}
globalAlternatives.org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy=org.apache.deltaspike.jpa.impl.transaction.BeanManagedUserTransactionStrategy
{code}

We tried with only putting the transaction manager in beans.xml, but an error 
was being generated where the system couldn't retrieve a transaction when 
performing the remove operation.

{quote}
Can you confirm the entity is attached to a persistence context before calling 
the remove method?
{quote}
I can confirm it. I first retrieve the entity by id and in the same method i 
remove it, like so:
{code:java}
public void removeValue(ValorParametreTecnic value) {
    ValorParametreTecnic reattachedValue = 
valorParametreTecnicRepository.findBy(value.getId());
    valorParametreTecnicRepository.removeAndFlush(reattachedValue);
}
{code}
Upon reaching the second line, the reattachedValue is a fully initialized 
object and it shouldn't have leaved the transactional context. This method is 
in the same class that performs the update and creation operation on the same 
entity, an EJB Stateless bean.
{code:java}
@Stateless
public class ParametreTecnicBO extends BaseBO<ParametreTecnic> 
{code}

{quote}
What is the Hibernate log output when show_sql is enabled?
{quote}
Now comes the interesting part. I get no SQL output whatsoever for this 
operation. I do get it for the retrieval operation performed before to obtain 
an attached object, but none when calling the remove operation. It's quite the 
mistery.

I've tried to change the transaction strategy to ContainerManaged, since the 
transaction would come from the EJB (container provided, as I understand it), 
but to no effect.

> remove() and removeFlush() doesn't seem to perform the operation
> ----------------------------------------------------------------
>
>                 Key: DELTASPIKE-734
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-734
>             Project: DeltaSpike
>          Issue Type: Bug
>          Components: Data-Module
>    Affects Versions: 1.0.2
>         Environment: Windows 7, JBoss EAP 6.3, Deltaspike 1.0.2, intel i5
>            Reporter: Loïc Prieto Dehennault
>
> We've recently moved the project from a custom-built JPA query 
> builder/executor to deltaspike Data, using the EntityRepository interface to 
> perform CRUD operations, and the remove and removeFlush methods of 
> EntityRepository do not seem to perform the operation. They pass without 
> error, but nothing is affected.
> The transaction context is provided by a Stateless EJB bean, which invokes 
> the methods of the repositories (that implement the EntityRepository and 
> CriteriaSupport interfaces).
> Update and create operations are performed correctly, only the remove 
> operation is not completed.
> Thats all I can think off the top of my head, if you need any more info, 
> please ask for it and I will gladly provide.
> Thanks,
> Loïc Prieto.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to