I'm a newbee if you want in hibernate transactions and I'm getting NOWHERE.
I realy need help
I'm using seam 2.0.1.GA but seam wants to manage all transactions for me
within my applicatio n I need to ACCEPT or REFUSE ALL and this is UNACCEPTABLE FOR ME
what I WANT TO DO is
Code:
LOOP
BEGIN TRANSACTION
DO what I NEED with my database
COMMIT or ROLLBACK ( ONLY THIS TRANSACTION)
But in any CASE CONTINUE with the rest of the loop
NEXT:
Seam seamingly can not handle that, since it wants the full controll
over the transactions, it adds an overall transaction that times out
and or falls over the rollback and I am DEAD.
For this reason I judged it is needed to KILL all SEAM INTERVENTION
The persistance.xml still indicates JTA and JTATransactions.
Code:
pesristence:
<persistence-unit name="httpscan" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/DDDDDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.show_sql?" value="true"/>
<property name="hibernate.format_sql?" value="true"/>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/scanEntityManagerFactory"/>
<!-- These are the default for JBoss EJB3, but not for HEM: -->
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
<property name="hibernate.jdbc.batch_size" value="20"/>
<!-- <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JbossTransactionManagerLookup"/> -->
Components:
<core:init debug="@debug@" jndi-pattern="@jndiPattern@" transaction-management-enabled="false" />
<core:manager concurrent-request-timeout="5000000"
conversation-timeout="200000000"
conversation-id-parameter="cid"/>
<transaction:no-transaction />
<persistence:managed-persistence-context name="entityManager"
auto-create="true"
persistence-unit-jndi-name="java:/scanEntityManagerFactory"/>
now I've the hard Job of setting things up again
I assume I have no container transaction management
and I see at least 3 different ways to use transactions and transaction defintions..
A) I assume I can still use the incected entityManager from seam (CAN I????)
at least I do not need to use JNDI as well
I have an entitymanager but I do not think I can access entity managerFactory
B) CAN I use transactions, directly handling queries& updates with the entityManger
Code:
setupTransaction however I need to do it ...
em.createQuery(SQL)....
commit transaction...
I want , if possible to know how I can setup the transactionFactory so I
can define a transaction, Ive tried but I get all kinds of complains
to much to state here.
What do I need ?
A transaction factory ???
A transaction getting from somewhere
A transaction begin if htat is not the same as above
what I want to do
is stated in the beginning
I need to creat different SEparate transaction contexts that I can rollback or commit
without stopping the loop, or put any punischment on the next transaction in the loop.
C) The seam manual seems to indicate I can not use the entityManager as stated in B
is this true ???? or am I mistaken
D) Seam seams to insinuate I need to delegate to a session
A'm troubled here since what ias the use of having a session at this stage
using the session the Hibernate Calls (queries )are changing format so I guess
I'm not using JTA any more but plain Hibernate right ????
E) in any case I tried it as well but without any real luck.
As I create the session, i can get a transaction and begin a transaction.
I never found out what the differnce was (setup/initiate transaction ,,, versus the begin
possible , but I get troubled with
Code:
TransactionException err: Could not register synchronization for container transaction
I thought using delegation I got rid of the container Transaction.
as You can see I'm in a mess now.
D) is there a way to find out what to do next
eventualy an example on how to setup the transaction system starting from seam
(as I use JNDI, I get into a simmular mess anyhow)
I'm fully blocked at this stage and getting more and more confused,
can anyone please give me a hint to get out of this mess
Thanks in advance