excume me guys,
i've a problem and i need your help.
I'm developing a jsf application.
I've 2 mysql tables
experiment(id_exp(autoincremented), name, author)
sample(id_sample(autoincremented),id_exp,value)
My application performs inserting into the 2 table.
My question is:
when i do insert in experiment in my query i don't use id_exp attribute
because it's autoincremented and everythings go well.
Later i've to insert more samples entities in sample table relating to
the same experiment inserted,that is i've more samples for the same
experiment.
What have i pass in my insert query on sample for id_exp to reference
the experiment autoincremented id before inserted?
I have to do everythings in one transaction(the 2 insert queries)..
can you help me?
Thanks very much
Moiristo - 22 Aug 2006 11:41 GMT
> excume me guys,
> i've a problem and i need your help.
[quoted text clipped - 16 lines]
> I have to do everythings in one transaction(the 2 insert queries)..
> can you help me?
I have about the same question. Consider a transaction where the first
insert statement creates an ID that I need for two other queries in the
same transaction. How can this be done? When I just create a transaction
(autocommit false), a deadlock occurs. I'm using j2ee with the latest
mysql connector on mysql5.
Thomas Kellerer - 22 Aug 2006 12:12 GMT
> excume me guys,
> i've a problem and i need your help.
[quoted text clipped - 17 lines]
> can you help me?
> Thanks very much
getGeneratedKeys() should return the generated IDs:
http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html#getGeneratedKeys()
Thomas

Signature
It's not a RootKit - it's a Sony