Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Generated code> Oracle sequence not correct
 

Pages: 1
Generated code
Oracle sequence not correct
Page:1/1 

  Print all messages in this thread  
Poster Message
Puromtec
User



Location:
MD
Joined on:
22-Jun-2005 16:38:52
Posted:
48 posts
# Posted on: 09-May-2006 20:33:07.  
I am using Oracle 10g and have a problem with the sequence values. When I save an entity (using self-servicing) it obtains the correct "next" sequence value inside the entity object. However, on the database side, the table actually jumps +2. So I get errors following this, since there is no record of the proper sequence in c# side.

Thanks,
Darren
  Top
sparmar2000
User



Location:
Aylesbury, UK
Joined on:
30-Nov-2003 14:50:22
Posted:
341 posts
# Posted on: 10-May-2006 03:54:39.  
This is very strange. What happens if you insert a row in the same table using SQL. Does it still jump +2?

What verson of LLBLGen Pro are you using.


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
34702 posts
# Posted on: 10-May-2006 10:34:08.  
Check if you have an insert trigger on the table.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Puromtec
User



Location:
MD
Joined on:
22-Jun-2005 16:38:52
Posted:
48 posts
# Posted on: 10-May-2006 14:40:55.  
First, thanks for responding.....

1. The database column auto increments properly when I do a manual insert from ISQL


2. I have an "insert before" trigger on the table. I have dropped the table and recreated it with the trigger (there are only two triggers in the schema, one for another table)

I will test this by deleting the other trigger. This is a new project/database, so there aren't many tables at this point.


...and version of llbl gen pro:

1.0.2005.1 Final
Released March 31st, 2006


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
34702 posts
# Posted on: 10-May-2006 15:31:32.  
It's definitely the trigger. It will increase the sequence with one and because the llblgen pro query will also increase the sequence with one, you'll get an increase of 2.

If you can't drop the triggers, because they're needed, you can tell llblgen pro not to use sequences with nextval, by using a setting in the config file of your application. Please see the documentation on this: "Application configuration through config files"
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Puromtec
User



Location:
MD
Joined on:
22-Jun-2005 16:38:52
Posted:
48 posts
# Posted on: 10-May-2006 15:50:36.  
Thanks, that works.

  Top
like2175
User



Location:
Camberley, United Kingdom
Joined on:
27-Mar-2006 16:16:06
Posted:
73 posts
# Posted on: 15-May-2006 15:48:09.  
I have oracle triggers in place to "catch" situations where I may be bulk filling the database without using the vb.net application.

The trigger only inserts a sequence number if it would otherwise be null. In this way will it will happily coexist with LLBLGenPro.

Code:
CREATE OR REPLACE TRIGGER session_error_id BEFORE INSERT
On if.app_session_error
FOR EACH ROW

BEGIN
    IF :NEW.app_session_error_id IS NULL THEN
     SELECT app_session_error_seq.NEXTVAL
        INTO :NEW.app_session_error_id
     FROM DUAL;
    END IF;
END;

  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
34702 posts
# Posted on: 15-May-2006 21:39:51.  
GREAT tip! Regular Smiley

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.