Results 1 to 5 of 5

Thread: How change sequence system

  1. #1
    Join Date
    Sep 2010
    Posts
    12

    Default How change sequence system

    Hello

    I created a project with the following roo command:

    Code:
    persistence setup --provider HIBERNATE --database POSTGRES --databaseName db --userName name --password pass
    
    entity --class ~.domain.Person --testAutomatically
    field string --fieldName firstName --notNull 
    field string --fieldName lastName --notNull 
    field date --fieldName birthDate --notNull  --type java.util.Date
    this generates a sequence called "hibernate_sequence"

    Then I modified:

    Code:
    .
    .
    .
    @RooJavaBean
    @RooToString
    @RooEntity
    @Entity
    @SequenceGenerator(name = "person_seq", sequenceName = "person_seq_id", allocationSize = 1, initialValue = 1) 
    public class Person {
    to Person.java


    Code:
    .
    .
    @Id
        @GeneratedValue(generator = "person_seq")
        @Column(name = "id")
        private Long Person.id;
    .
    .
    to Person_Roo_Entity.aj

    But The sequence is still asociated to "hibernate_sequence"

    How I can generate one sequence for each table

    thanks

  2. #2
    Join Date
    Dec 2007
    Location
    Stockholm, Sweden
    Posts
    190

    Default

    Shahzada Hatim
    @geoaxis/twitter
    http://hatimonline.com

  3. #3
    Join Date
    Sep 2010
    Posts
    12

    Unhappy

    Hello

    I've RTFM from the link

    I tried with --inheritanceType [ TABLE_PER_CLASS | SINGLE_TABLE | JOINED ] combinations

    I also tried

    Code:
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="generator")
    @SequenceGenerator(name="generator", sequenceName="person_id_seq")
    @Column(name = "id")
    private Long Person.id;
    But a sequence or table called "hibernet_secuence" is always generated

    I need a sequence for each table.

    help .. please

  4. #4
    Join Date
    Dec 2005
    Posts
    930

    Default

    Are you editing the .aj file? If so, this is not advised as they will be written over. Did you try push-in refactoring so that the @Id field and its accessor/mutator are in the Java file, and then modify the sequence generator?
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  5. #5

    Default

    I don't have any GeneratedValue tag in my codes. But my app always requires a hibernate_sequence to be created. How can I get rid of that?

Posting Permissions

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