On 8/07/2005 10:37 PM, Aaron Mulder wrote:

On Fri, 8 Jul 2005, Aaron Mulder wrote:
Gianny,
        My understanding of AutoIncrementPrimaryKeyWrapper is that it
executes an insert on some table during the PK generation phase.  I
thought that couldn't be the "entity table" since then when the entity
goes to insert itself it would find that the row already existed.  How is
it that the AutiIncrement PK generator communicates to the entity that its
row already exists?

Also, what would the SQL be for the AutoIncrementTable primary key wrapper? Doesn't the CMP engine generate the SQL for an insert into the entity table? If the AUTO_INCREMENT column is on the entity table then I'd think you'd just want the PK generator to just list the columns that should be populated by the DB so the generated insert statement could skip those and then the CMP engine could fetch the values after the insert was completed.
At this stage, the INSERT statement needs to be explicitly provided; this can be enhanced. I confirm that the sql should insert a row in the "entity table".

Thanks,
Gianny

Thanks,
        Aaron

On Fri, 8 Jul 2005, Gianny Damour wrote:
1) Implement a PK Generator that handles an EJB on a table that automatically populates a PK value in itself (via an AUTO_INCREMENT column or a trigger or whatever). I think it would basically just hold a column name, and then the part of TranQL that created entities would need logic to recognize that, perform the insert as usual, and then fetch the PK ID value as an auto-generated key afterward.


org.tranql.pkgenerator.AutoIncrementTablePrimaryKeyGenerator does that.


Reply via email to