Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] id table not using specified non transactional connection

Any way to do this without having to write specific case? Maybe some detailed logging from eclipselink?

Le sam. 18 mars 2017 à 19:33, andrei ilitchev <andrei.ilitchev@xxxxxxxxxx> a écrit :

I would test it:

start user JTA transaction;
obtain nonJta connection;
set its autoCommit to false;
write something
commit  // if it's JTA-managed connection this probably will throw exception
rollback User jta transaction

see if the written object is found in the db


On 3/18/2017 2:03 PM, Yannick Majoros wrote:
I have this configuration in Payara for this connection:

<jdbc-connection-pool non-transactional-connections="true" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" name="gestempsNonJtaPool" res-type="javax.sql.DataSource">
      <property name="Password" value="[edited]"></property>
      <property name="ServerName" value="db"></property>
      <property name="DatabaseName" value="gestemps"></property>
      <property name="User" value="gestemps"></property>
    </jdbc-connection-pool>
    <jdbc-resource pool-name="gestempsNonJtaPool" jndi-name="jdbc/gestempsNonJta"></jdbc-resource>

Does it look good to you, or should I check anything else?

Le ven. 17 mars 2017 à 10:54, andrei ilitchev <andrei.ilitchev@xxxxxxxxxx> a écrit :

I don't believe that you need

            <property name="eclipselink.connection-pool.sequence" value="true"/>
but if I remember correctly it should not make any difference.

It's imperative that
jdbc/gestempsNonJta
is really a non-jta managed data source.

Thanks,
Andrei

On 3/17/2017 3:19 AM, Yannick Majoros wrote:
Hello,

I tried to configure a non-transactional connection pool for id table on mysql. 

While I checked the docs, I think they are sometimes confusing: I'm not always sure on which properties to specify. I've seen examples in camel case, others with hyphens; some with sequence-specific connection pools and some with a simple boolean which in my understanding would enable my table-generated ids to use the non-jta connection.

So, here are my current settings:
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="Gestemps-PU" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <jta-data-source>jdbc/gestemps</jta-data-source>
        <non-jta-data-source>jdbc/gestempsNonJta</non-jta-data-source>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
        <properties>
            <property name="eclipselink.connection-pool.sequence" value="true"/>
            <property name="eclipselink.logging.level" value="INFO" />
            <property name="eclipselink.logging.level.sql" value="FINE" />
            <property name="eclipselink.logging.parameters" value="true" />
        </properties>
    </persistence-unit>
</persistence>

But I still get the dreaded "Lock wait timeout exceeded".

So, here are my questions:
1) Is this setup right to get a non-transactional connection for my id's (JPA, @TableGenerator, mysql)?
2) Did I make any mistake in the property names? Should I use other properties?

Here is the error (probably when there is another long-running transactions):

Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.2.qualifier): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
Error Code: 1205
Call: UPDATE seq SET VALUE = VALUE + ? WHERE NAME = ?
	bind => [50, ID]
Query: DataModifyQuery(name="ID" sql="UPDATE seq SET VALUE = VALUE + ? WHERE NAME = ?")

Thanks,
Yannick Majoros
--
Yannick Majoros
rue Haute 19
5140 Ligny


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
Yannick Majoros
rue Haute 19
5140 Ligny


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
Yannick Majoros
rue Haute 19
5140 Ligny

Back to the top