You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Bogdan Vatkov <bv...@globaltech-bg.com> on 2004/06/02 15:28:42 UTC

Bug ?


Guys,
I think here is a bug:
Pre:

A Primary Key does not tell us that this a field that is going to be created on the Database-server-side.
AFAIK there are 2 ways for this:
1) This is done by creating an Autoincrement column and thus to force the DB server to fill a value for it.
2) This is done by marking a column as NOT NULL and define DEFAULT value and passing a NULL value for it int he SQLs

but in the BasePeer.vm we see the following:

/** Build a Criteria object from the data object for this peer */

public static Criteria buildCriteria( $table.JavaName obj )

{

Criteria criteria = new Criteria(DATABASE_NAME);

#foreach ($col in $table.Columns)

#set ( $cfc=$col.JavaName )

#set ( $cup=$col.Name.toUpperCase() )

#if ($col.isPrimaryKey() && !$table.IdMethod.equals("none"))

if (!obj.isNew())

#end

criteria.add($cup, obj.get${cfc}());

#end

return criteria;

}





So we are by-passing all primary keys, shouldn't we by-pass all Autoincrements ?

And this:

#if ($col.isPrimaryKey() && !$table.IdMethod.equals("none"))

To become this:

#if ($col.isAutoIncrement() && !$table.IdMethod.equals("none"))



Regards,

Bogdan