Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8274487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:44:43+00:00 2026-06-08T07:44:43+00:00

I have POJO domain class in Grails/PostgreSql app and I’m trying to map postgres

  • 0

I have POJO domain class in Grails/PostgreSql app and I’m trying to map postgres sequence generatorg for its ID.

In POJO:

@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "flight_id")
public long getId() {
    return id;
}

In Postgres:

-- Sequence: flight_id

-- DROP SEQUENCE flight_id;

CREATE SEQUENCE flight_id
  INCREMENT 1
  MINVALUE 1n 
  MAXVALUE 9223372036854775807
  START 1
  CACHE 1;
ALTER TABLE flight_id
  OWNER TO postgres;

When I try running grails generate-all for that domain I get:

 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.AnnotationException: Unknown Id.generator: flight_id

Everything else seems to working ok, except this. I’m trying to use Postres native generator so I have the option of running CRUD operations against the DB that is independent of the Grails app.

Any hints would be most appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:44:44+00:00Added an answer on June 8, 2026 at 7:44 am

    There is two problems:

    1. usage of GenerationType.AUTO (persistence provider chooses strategy freely) when GenerationType.SEQUENCE seems to be preferred and
    2. false assumption that flight_id in generator = "flight_id" refers directly to the name of database sequence, when it actually refers to: (following directly from documentation):

      The name of the primary key generator to use as specified in the
      SequenceGenerator or TableGenerator annotation

    What should be done is changing strategy to GenerationType.SEQUENCE and defining SequenceGenerator that is consistent with database sequence and does have same value for name attribute as is value of generator attribute in GeneratedValue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following POJO: public class SampleBean1 { @Id @GeneratedValue(generator = system-uuid) @GenericGenerator(name
I have a persistence annotated POJO for a domain class and all works great,
I have a POJO that uses a service to do something: public class PlainOldJavaObject
I have a POJO, and a (currently not-yet-built) class that will return Lists of
Let's say I have following POJO's using Hibernate. public class User { private String
Let's say I have a simple POJO class: public void Foo { public int
I have one Pojo class in which I create one field which is not
I have a variable that is a linked hash map. Its like: message: something
I have a pojo class class Foo{ String a String b . . //
I have POJO classes: class Ticket { private int id; private double cost; private

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.