No if one is doing with DB directly or with JDBC, the following will
work:
-- start transaction
INSERT INTO t_1 (name) VALUES ('name1');
INSERT INTO t_1 (name) VALUES ('name2');
INSERT INTO t_2 (name,t_1_id) select 'name1' , t_1.id from t_1 where
t_1.name='name1';
commit; -- end transaction
On 23/04/2009, at 12:53 AM, Joseph Schmidt wrote:
Of course I demonstrated. The snippet in the parent just works with
MySQL (with InnoDB of course).
There's no need for a last_insert_id(), since the PK are
"autoincrement". Inside the same transaction, the consequent selects
will simply pic
Might be a long shot, but if you start a root transaction at the start
of PrePersist and then commit it in PostPersist, maybe that will work.
On Wed, Apr 22, 2009 at 12:57 PM, Joseph Schmidt
wrote:
>> You might also take a look at the 3.0 lifecycles that Ari mentioned
>> in the issue, but my gue
You might also take a look at the 3.0 lifecycles that Ari mentioned
in the issue, but my guess is that JPA lifecycles won't do what is
needed.
I did. To be inside the same transaction for writing, PrePersist would
be the logical choice
(from what I understood the docs). The very short document
I've done auditing a couple of ways in the past. The first time, in
Cayenne 1.1, I did it at the application level using customized entity
templates and setAndLog() methods instead of set() methods. It
wasn't ideal, and it didn't work for many-to-many joins (never had any
many-to-manys back the
FWIW, we are planning on filling in our Audit table using triggers on
the tables we care about auditing. This will also capture changes
made outside of Cayenne.
On Wed, Apr 22, 2009 at 10:53 AM, Joseph Schmidt
wrote:
>
>>> I'd be interested in hearing what others have to say... feasible given
>>
I'd be interested in hearing what others have to say... feasible given
the current cayenne stack?
The problem is that the original poster is trying to use Cayenne like he
uses pure SQL and
No, I'm not.
Like I mentioned in earlier posts, I'm using ObjRelationships and all
the Cayenne goodie
On 22/04/2009, at 2:58 AM, Robert Zeigler wrote:
Hm have you considered using runtime relationships? (NOTE: I've
never played with this, myself, so take the next bit with a grain of
salt. :)
In theory, it's entirely possible with cayenne to have a single
generic data object and then mo
Hm have you considered using runtime relationships? (NOTE: I've
never played with this, myself, so take the next bit with a grain of
salt. :)
In theory, it's entirely possible with cayenne to have a single
generic data object and then modify the mapping information at runtime
as necessa
Hm. You're defining a relationship; I've always mapped relationships aas
relationships, and let Cayenne deal with the id specifics. Note that
cayenne won't force the creation foreign key (although you should create
one, if your db supports it).
You say you have "too many tables like that"...
Hm. You're defining a relationship; I've always mapped relationships
aas relationships, and let Cayenne deal with the id specifics. Note
that cayenne won't force the creation foreign key (although you should
create one, if your db supports it).
You say you have "too many tables like that".
* write the record to database, fetch it back again and
then you'll have the primary key
Than this is not the same transaction :(.
Correct. This is a limitation of how databases work, not Cayenne. You
can't have a primary key until you write the record, unless you do
something tricky like u
> It sounds like you are trying to
> write a record into a log/audit
> table.
Yes, for some entities it is some sort of high level
audit, and for others it is a recent activity table.
> Have you looked at MySQL triggers to do
> this? The advantage
> of using a trigger is that even if someone c
I would only be
semi-comfortable exposing a primary key if it were encrypted by a
private key that changed per-session.
Just my thoughts...
mrg
On Tue, Apr 7, 2009 at 9:03 PM, Joseph Schmidt
wrote:
>
>> > Can't get primary key from temporary id
>> >
>&g
On Apr 8, 2009, at 3:28 , Aristedes Maniatis wrote:
On 08/04/2009, at 11:03 AM, Joseph Schmidt wrote:
* write the record to database, fetch it back again and
then you'll have the primary key
Than this is not the same transaction :(.
Correct. This is a limitation of how databases work, not C
On 08/04/2009, at 11:03 AM, Joseph Schmidt wrote:
* write the record to database, fetch it back again and
then you'll have the primary key
Than this is not the same transaction :(.
Correct. This is a limitation of how databases work, not Cayenne. You
can't have a primary key until you writ
> > Can't get primary key from temporary id
> >
> >
> > while trying to access the 'id' of a newly created
> object entity A.
> > I need this 'id' to write the value together with some
> > other fields in some other
On 08/04/2009, at 8:26 AM, Joseph Schmidt wrote:
Can't get primary key from temporary id
while trying to access the 'id' of a newly created object entity A.
I need this 'id' to write the value together with some other fields
in some other object
I'm getting the following error:
Can't get primary key from temporary id
while trying to access the 'id' of a newly created object entity A.
I need this 'id' to write the value together with some other fields in some
other object entity
19 matches
Mail list logo