user id as initial value with 1000000000000000

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

user id as initial value with 1000000000000000

uttam
Sir,

i have a user table which id i need as initial value as 100000000000000.with increment of 1.while declaring in user domain class as long it.Hibernate is creating int(11).If not declaring in then hibernate is creating bigint(20) size.

now i have set the as initial value start from 100000000000000

id generator: "org.hibernate.id.enhanced.SequenceStyleGenerator", params: [initial_value:10000, increment_size:1]


in static mapping with the declaration of long id.now how to define it.My class is like


User {

        transient springSecurityService
        long id
        String username
        String password
        String firstname
        String lastname
        String email
        String mobile
        String dob
        String gender
        String country
        String state
        String city
        boolean enabled = true
        boolean accountExpired
        boolean accountLocked
        boolean passwordExpired

        static transients = ['springSecurityService']

        static constraints = {
                username blank: false, unique: true
                password blank: false
        }
        static mapping = {
                password column: '`password`'
                //id generator: "org.hibernate.id.enhanced.SequenceStyleGenerator", params: [initial_value:100000000000000, increment_size:1]
        }


Error Log is

Error |
2014-01-06 16:53:28,977 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=com.testapp.User]
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=com.testapp.User]
    Line | Method
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=com.testapp.User]
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=com.testapp.User]
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by MappingException: Could not instantiate id generator [entity-name=com.testapp.User]
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by NumberFormatException: For input string: "100000000000000"
->>   65 | forInputString in java.lang.NumberFormatException
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    495 | parseInt  in java.lang.Integer
|    527 | parseInt  in     ''
|    334 | innerRun  in java.util.concurrent.FutureTask$Sync
|    166 | run . . . in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run       in java.lang.Thread
Error |
Forked Grails VM exited with error