Results 1 to 3 of 3

Thread: DBRE on Oracle table

  1. #1
    Join Date
    Mar 2012
    Posts
    2

    Default DBRE on Oracle table

    Hi all!

    I am new to Spring Roo and JPA and this stuff.
    The database table I try to generate a model and a (Vaadin) UI for is very simple:

    Column: id Type: Integer
    Column: text Type: Varchar2(32)

    For the column “id” I have created a sequence and a trigger setting “nextVal” before insert into the column ID.
    Everything is fine within my database client (DbVisualizer).

    The persistence is setup with “eclipselink” as JPA provider, because I have learned, that “eclispelink” is mandatory for Vaadin at the moment. For the same reason I am still using Roo 1.1.5.

    In the RooShell (within STS) I do

    Code:
    database reverse engineer --schema MY_SCHEMA --includeTables "MY_TABLE"
    and

    Code:
    vaadin generate all --package ~.web.ui --visuallyComposable true
    My generated UI works fine, displays all the items, I am able to select, edit and update an item, but in case of “insert” (Button “New”) I get an exception:

    Code:
    Error Code: 942
    Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
    	bind => [2 parameters bound]
    Query: DataModifyQuery(name="SEQUENCE" sql="UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?")
    I assume I am doing something basically wrong here. For I found no tutorial and I think this is a basic problem all Oracle Roo projects may have it would be nice to have a tutorial for this….

    Regards,
    Philipp

  2. #2
    Join Date
    Mar 2012
    Posts
    2

    Default

    Hi.

    I really need your help! Please help me.

    Thank you.

    Regards,
    Philipp

  3. #3
    Join Date
    May 2006
    Location
    Madrid
    Posts
    383

    Default

    You have provided little information in order to help you.

    Roo creates the identifier for a table with a strategy of auto-generate values:

    Code:
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id")
        private Long MyTable.id;
    I don't know Oracle, but I assume that it will use a global table (I presume it is called SEQUENCE) for the entire database with a row for each table (for instance, your MY_TABLE) storing the next sequence value (or the last used to provide the next, who cares)

    Maybe your error is related with that:

    Code:
    Error Code: 942
    Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
    	bind => [2 parameters bound]
    Query: DataModifyQuery(name="SEQUENCE" sql="UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?")
    Find what does mean "Error Code: 942" and try to fix it.

    You have an alternative with Roo: move the id field with its get and set methods to the Java class, and use another strategy for generating values. You can even obviate the annotation, thus the ids should be provided manually.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •