tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keulkeul <baron.mick...@gmail.com>
Subject Re: HBM2DDL tool throws a java.sql.SQLException exception (Auto-commit can not be set while enrolled in a transaction)
Date Fri, 13 Nov 2009 16:16:33 GMT

Hi Andy,

Thanks for your replying. I didn't think about this solution, it's great.

To test your solution, i have impacted the DeployerEjb class in annotating
the "deploy" method directly from the sources of OpenEJB and ... it's
working :clap:

To avoid to impact directly the sources of OpenEJB, what is the best
solution ?

Best regards


Andy Gumbrecht wrote:
> 
> I had a very similar scenario - but could not really decide if this is 
> actually a bug or feature.
> 
> I am sort of leaning towards 'bug' after 1. Having a look at 
> org.apache.openejb.assembler.DeployerEjb, and 2. Having written my own 
> workaround.
> 
> I had written my own deployer ejb due to the fact that I have special 
> case dynamic deployments with build numbers, i.e. app.build.1.jar and 
> app.build.2.jar for example.
> 
> I also noticed this exact same java.sql.SQLException: Auto-commit issue.
> 
> My solution was to apply the following to my bean 'deploy' method:
> 
> @TransactionAttribute(TransactionAttributeType.NEVER)
> 
> This resolved the issue, and I believe that this would also apply to the 
> org.apache.openejb.assembler.DeployerEjb 'deploy' method.
> 
> This attribute obviously disables any transaction (of which the 
> persistence-unit is a subscriber) during the deployment.
> 
> I have not reported this as an issue, as I have not had the time to see 
> how other containers react given a similar scenario.
> 
> Your post has prompted me to answer this though.
> 
> Best regards,
> 
> Andy.
> 
> On 13.11.2009 14:13, Keulkeul wrote:
>> I'm using an OpenEJB standalone server for deploying a sample application
>> which contains a set of POJOs (EJB Entity using JPA and Hibernate
>> technologies) and services.
>>
>> The schema of the database (DDL) is obtained by the hbm2ddl tool (the
>> following property is configured into the persistence.xml (<property
>> name="hibernate.hbm2ddl.auto" value="update" />)). Unfortunately, during
>> the
>> hbm2ddl schema update step an exception is occurred
>> (java.sql.SQLException:
>> Auto-commit can not be set while enrolled in a transaction).
>>
>> Here is the scenario which leads to my problem
>>
>> - I'm starting an OpenEJB standalone server (openejb.bat start)
>> - I'm deploying my sample application sample.jar (openejb.bat deploy
>> d:\openejb-3.1.2\sample.jar)
>>
>> The deploying is working. sample.jar file is copied into the Apps
>> directory
>> of the OpenEJB directory. In checking the hibernate logs, i noticed that
>> all
>> POJOs are binded with its associated table. However when hbm2ddl schema
>> update tool is started, i have a set of type exception
>> java.sql.SQLException: Auto-commit can not be set while enrolled in a
>> transaction.
>>
>> On the other side, if the OpenEJB standalone server is not yet started
>> and
>> if i copy directly sample.jar file into the Apps directory of OpenEJB
>> installation (in fact, i have done an explicit deploy) and finally if i
>> start the OpenEJB standalone server, the hbm2ddl schema update is
>> working.
>> All the tables are created into the database.
>>
>> Any idea about this problem ?
>>    
> 
> 
> -- 
> ------------------------------------------------------------------------
> 
> *Andy Gumbrecht*
> Software Developer
> Orpro Vision GmbH
> Hefehof 8, 31785, Hameln
> 
> Tel +49 (0) 5151 809 44 21
> Cell +49 (0) 174 1800 381
> Email andy.gumbrecht@orprovision.com
> Web www.orprovision.com
> 
> 
>             Orpro Vision GmbH
>             Sitz der Gesellschaft: 31785, Hameln
>             USt-Id-Nr: DE264453214
>             Amtsgericht Hannover HRB204336
>             Geschaeftsfuehrer: Roberto Gatti
> 
> ------------------------------------------------------------------------
> 
> 
>             Diese E-Mail enthält vertrauliche und/oder rechtlich
>             geschützte Informationen. Wenn Sie nicht der richtige
>             Adressat sind oder diese E-Mail irrtümlich erhalten haben,
>             informieren Sie bitte sofort den Absender und vernichten Sie
>             diese Mail. Das unerlaubte Kopieren, jegliche anderweitige
>             Verwendung sowie die unbefugte Weitergabe dieser Mail ist
>             nicht gestattet.
> 
> ------------------------------------------------------------------------
> 
> 
>             This e-mail may contain confidential and/or privileged
>             information. If you are not the intended recipient (or have
>             received this e-mail in error) please notify the sender
>             immediately and destroy this e-mail. Any unauthorized
>             copying, disclosure, distribution or other use of the
>             material or parts thereof is strictly forbidden.
> 
> ------------------------------------------------------------------------
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/HBM2DDL-tool-throws-a-java.sql.SQLException-exception-%28Auto-commit-can-not-be-set-while-enrolled-in-a-transaction%29-tp26336380p26339150.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Mime
View raw message