The code in 1.1-SNAPSHOT already uses sequences for Oracle. Here's the
relevant code:

  override def primaryKeySetup(tableName : String, columnName : String) :
List[String] = {
    /*
     * This trigger and sequence setup is taken from
http://www.databaseanswers.org/sql_scripts/ora_sequence.htm
     */
    super.primaryKeySetup(tableName, columnName) :::
    List("CREATE SEQUENCE " + tableName + "_sequence START WITH 1 INCREMENT
BY 1",
         "CREATE OR REPLACE TRIGGER " + tableName + "_trigger BEFORE INSERT
ON " + tableName + " " +
         "FOR EACH ROW " +
         "WHEN (new." + columnName + " is null) " +
         "BEGIN " +
         "SELECT " + tableName + "_sequence.nextval INTO :new." + columnName
+ " FROM DUAL; " +
         "END;")
  }

Are you running into an issue with it?

Derek

On Tue, Nov 10, 2009 at 1:46 AM, aw <anth...@whitford.com> wrote:

>
> For Oracle database tables, one typically creates a Sequence to
> provide primary key values.  For example:
>
> create table WIDGET (
>    id Number(8,0) not null,
>    name varchar2(50) not null,
>    ...
>    constraint WIDGET_PK primary key (id),
>    ...
> )
> create sequence WIDGET_ID_SEQ
>
> When creating records using Mapper, is there a convenient way to get
> Mapper to automatically leverage the corresponding sequence to
> populate the id column?
>
> (Why Oracle doesn't do this automatically in 2009 like SQL Server,
> Sybase, and other database systems, is beyond me...)
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to