Thank you for the update. If the same problem comes up again, the solution can
be googled now.
Regards,
-marina
Oleg Mayevskiy wrote:
> Hello.
>
> I don`t use EclipseLink. I also don`t want to switch from Hibernate to
> Eclipse, because i use some hibernate specific hql statements.
>
> I solved this problem by enabling the hibernate loging (switching the
> slf4j jar from nop to jdk1.4 in my case).
>
> Here is the log statement that helped me:
>
> Cannot join transaction: do not override
> hibernate.transaction.factory_class
>
> so i REMOVED this 2 properties from my persistence.xml file:
>
> <property name="hibernate.transaction.manager_lookup_class"
> value="org.hibernate.transaction.SunONETransactionManagerLookup"/>
>
> <property name="hibernate.transaction.factory_class"
> value="org.hibernate.transaction.CMTTransactionFactory"/>
>
> after a redeploy the problem was gone and updates + inserts work now
> nice again.
>
>
>
> Oleg.
>
> PS: at the end it was a hibernate issue, not a problem with glassfish,
> so sorry for posting it to wrong email list.
>
>
> Am 07.08.2010 00:14, schrieb Marina Vatkina:
>
>> Do you see inserts and updates if you switch to use EclipseLink?
>>
>> Oleg Mayevskiy wrote:
>>
>>> I call it via localInterface invokation from a simple servlet.
>>>
>>> Am 06.08.2010 23:05, schrieb Marina Vatkina:
>>>
>>>> How do you call this method?
>>>>
>>>> Oleg Mayevskiy wrote:
>>>>
>>>>> yes the transaction commits, and the business method exits too, but
>>>>> there are no update or insert statements in the transaction.
>>>>> also if i add an em.flush() at the end of the business method, then
>>>>> update statements are done.
>>>>>
>>>>> Am 06.08.2010 21:43, schrieb Marina Vatkina:
>>>>>
>>>>>> Do you wait until transaction commits, or do you check before the
>>>>>> business method exits?
>>>>>>
>>>>>>
>>>>>> Oleg Mayevskiy wrote:
>>>>>>
>>>>>>> I am watching database statement logs, also tables that should be
>>>>>>> filled with new data. Additional i see all statements produced by
>>>>>>> hibernate in java logs, because of hibernate.show_sql property.
>>>>>>>
>>>>>>> Am 06.08.2010 20:58, schrieb Marina Vatkina:
>>>>>>>
>>>>>>>> Hi Oleg,
>>>>>>>>
>>>>>>>> How do you check that nothing is flushed to the database?
>>>>>>>>
>>>>>>>> -marina
>>>>>>>>
>>>>>>>> Oleg Mayevskiy wrote:
>>>>>>>>
>>>>>>>>> Hi.
>>>>>>>>>
>>>>>>>>> I have a question about a following abstract problem.
>>>>>>>>>
>>>>>>>>> i have a stateless bean like this:
>>>>>>>>>
>>>>>>>>> @Stateless
>>>>>>>>>
>>>>>>>>> Public class MyBean implements MyLocalInterface {
>>>>>>>>>
>>>>>>>>> ….
>>>>>>>>>
>>>>>>>>> @PersistenceContext(unitName = "ReadWritePU")
>>>>>>>>> private EntityManager em;
>>>>>>>>>
>>>>>>>>> ….
>>>>>>>>>
>>>>>>>>> @Override
>>>>>>>>>
>>>>>>>>> public void execute() {
>>>>>>>>>
>>>>>>>>> …
>>>>>>>>>
>>>>>>>>> em.find(…) (some finds)
>>>>>>>>>
>>>>>>>>> …
>>>>>>>>>
>>>>>>>>> em.merge(…) (some merges)
>>>>>>>>>
>>>>>>>>> …
>>>>>>>>>
>>>>>>>>> em.persist(…) (some persists)
>>>>>>>>>
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> but what happens on db is:
>>>>>>>>>
>>>>>>>>> BEGIN
>>>>>>>>> some SELECTs(from some finds)
>>>>>>>>> ....
>>>>>>>>> COMMIT
>>>>>>>>>
>>>>>>>>> so what happens is, entity manager does not flush the objects
>>>>>>>>> from merge and persist methods, no updates or inserts are done
>>>>>>>>> to the database. Also no Runtime Exceptions are thrown.
>>>>>>>>>
>>>>>>>>> But if i put an em.flush() at the end of the business method,
>>>>>>>>> every thing is ok and new objects are flushed to the db.
>>>>>>>>>
>>>>>>>>> What could be a reason for this behavior?
>>>>>>>>>
>>>>>>>>> I tried to change non-transactional-connections from false to
>>>>>>>>> true, the transaction-isolation-level from serializable to
>>>>>>>>> read-commited
>>>>>>>>> and is-isolation-level-guaranteed from true to false, but it
>>>>>>>>> did not help.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Here is my whole persistence.xml
>>>>>>>>>
>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>>
>>>>>>>>> <persistence version="1.0"
>>>>>>>>> xmlns="http://java.sun.com/xml/ns/persistence"
>>>>>>>>> <http://java.sun.com/xml/ns/persistence>
>>>>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>>>> <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"
>>>>>>>>> <http://java.sun.com/xml/ns/persistencehttp:/java.sun.com/xml/ns/persistence/persistence_1_0.xsd>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> <persistence-unit name="ReadWritePU" transaction-type="JTA">
>>>>>>>>>
>>>>>>>>> <provider>org.hibernate.ejb.HibernatePersistence</provider>
>>>>>>>>>
>>>>>>>>> <jta-data-source>jdbc/Postgres</jta-data-source>
>>>>>>>>>
>>>>>>>>> <exclude-unlisted-classes>false</exclude-unlisted-classes>
>>>>>>>>>
>>>>>>>>> <properties>
>>>>>>>>>
>>>>>>>>> <property name="hibernate.show_sql" value="true"/>
>>>>>>>>>
>>>>>>>>> <property name="hibernate.dialect"
>>>>>>>>> value="org.hibernate.dialect.PostgreSQLDialect"/>
>>>>>>>>>
>>>>>>>>> <property name="hibernate.order_updates" value="true"/>
>>>>>>>>>
>>>>>>>>> <property name="hibernate.transaction.manager_lookup_class"
>>>>>>>>> value="org.hibernate.transaction.SunONETransactionManagerLookup"/>
>>>>>>>>>
>>>>>>>>> <property name="hibernate.transaction.factory_class"
>>>>>>>>> value="org.hibernate.transaction.CMTTransactionFactory"/>
>>>>>>>>>
>>>>>>>>> </properties>
>>>>>>>>>
>>>>>>>>> </persistence-unit>
>>>>>>>>>
>>>>>>>>> <persistence-unit name="ReadOnlyPU" transaction-type="JTA">
>>>>>>>>>
>>>>>>>>> <provider>org.hibernate.ejb.HibernatePersistence</provider>
>>>>>>>>>
>>>>>>>>> <jta-data-source>jdbc/PostgresReadonly</jta-data-source>
>>>>>>>>>
>>>>>>>>> <exclude-unlisted-classes>false</exclude-unlisted-classes>
>>>>>>>>>
>>>>>>>>> <properties>
>>>>>>>>>
>>>>>>>>> <property name="hibernate.dialect"
>>>>>>>>> value="org.hibernate.dialect.PostgreSQLDialect"/>
>>>>>>>>>
>>>>>>>>> <property name="hibernate.show_sql" value="true"/>
>>>>>>>>>
>>>>>>>>> <property name="hibernate.transaction.manager_lookup_class"
>>>>>>>>> value="org.hibernate.transaction.SunONETransactionManagerLookup"/>
>>>>>>>>>
>>>>>>>>> <property name="hibernate.transaction.factory_class"
>>>>>>>>> value="org.hibernate.transaction.CMTTransactionFactory"/>
>>>>>>>>>
>>>>>>>>> </properties>
>>>>>>>>>
>>>>>>>>> </persistence-unit>
>>>>>>>>>
>>>>>>>>> </persistence>
>>>>>>>>>
>>>>>>>>> And here are my connection pool settings from the domain.xml
>>>>>>>>>
>>>>>>>>> <jdbc-connection-pool allow-non-component-callers="true"
>>>>>>>>> associate-with-thread="false"
>>>>>>>>> connection-creation-retry-attempts="0"
>>>>>>>>> connection-creation-retry-interval-in-seconds="10"
>>>>>>>>> connection-leak-reclaim="false"
>>>>>>>>> connection-leak-timeout-in-seconds="0"
>>>>>>>>> connection-validation-method="table"
>>>>>>>>> datasource-classname="org.postgresql.ds.PGConnectionPoolDataSource"
>>>>>>>>> fail-all-connections="false" idle-timeout-in-seconds="300"
>>>>>>>>> is-connection-validation-required="true"
>>>>>>>>> is-isolation-level-guaranteed="true"
>>>>>>>>> lazy-connection-association="false"
>>>>>>>>> lazy-connection-enlistment="false" match-connections="false"
>>>>>>>>> max-connection-usage-count="0" max-pool-size="32"
>>>>>>>>> max-wait-time-in-millis="60000" name="PostgresConnectionPool"
>>>>>>>>> non-transactional-connections="false" pool-resize-quantity="2"
>>>>>>>>> res-type="javax.sql.ConnectionPoolDataSource"
>>>>>>>>> statement-timeout-in-seconds="-1" steady-pool-size="8"
>>>>>>>>> transaction-isolation-level="serializable"
>>>>>>>>> validate-atmost-once-period-in-seconds="0"
>>>>>>>>> validation-table-name="pg_type" wrap-jdbc-objects="false">
>>>>>>>>>
>>>>>>>>> <property name="Password" value="********"/>
>>>>>>>>>
>>>>>>>>> <property name="PrepareThreshold" value="0"/>
>>>>>>>>>
>>>>>>>>> <property name="ServerName" value="******"/>
>>>>>>>>>
>>>>>>>>> <property name="DatabaseName" value="*****"/>
>>>>>>>>>
>>>>>>>>> <property name="LoginTimeout" value="0"/>
>>>>>>>>>
>>>>>>>>> <property name="User" value="*********"/>
>>>>>>>>>
>>>>>>>>> <property name="PortNumber" value="*******"/>
>>>>>>>>>
>>>>>>>>> <property name="Ssl" value="true"/>
>>>>>>>>>
>>>>>>>>> <property name="sslfactory"
>>>>>>>>> value="org.postgresql.ssl.NonValidatingFactory"/>
>>>>>>>>>
>>>>>>>>> </jdbc-connection-pool>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thank you very much
>>>>>>>>>
>>>>>>>>> Oleg Mayevskiy
>>>>>>>
>>>>>>>
>>>>>
>>>
>
>