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 8291749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:14:24+00:00 2026-06-08T13:14:24+00:00

In a One To One mapping, I wrote the following lines of code. @GenericGenerator(name

  • 0

In a One To One mapping, I wrote the following lines of code.

@GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name="property", value= "post"))
@Id
@GeneratedValue(generator = "generator")
public int getContent_id() {
    return content_id;
}

What is the significance of @Parameter(name=”property”, value= “post”). If I don’t write that line I’m getting an error

Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=in.codejava.personal.model.Content]

EDIT

When I changed the value = “post” to anything else like value=”post123″ etc it works. But it doesn’t work when I completely remove that. Partial Code http://pastebin.com/CjEpqtXV

  • 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-08T13:14:25+00:00Added an answer on June 8, 2026 at 1:14 pm

    It allows telling the generator from which property the ID must be extracted (in this case: “post”). An entity could have several OnetoOne associations. You need to tell it which one of them contains the ID of your entity.

    Note that this generator can be replaced by a standard JPA annotation on the OneToOne association containing the ID: @MapsId. The Hibernate documentation recommends its usage rather than the foreign generator.

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

Sidebar

Related Questions

I am trying to save a record which has a many-to-one property mapping. I
I wrote a mapping as like below: <hibernate-mapping auto-import=true default-lazy=false> <class name=com.saman.entity.hibernate.EmployeeEntity table=Employee optimistic-lock=version>
Is it possible to do a one-to-one mapping to a property, not using primary
I want to create a one to one mapping between the Entity Customer and
This is my Database structure, One-to-One mapping in MySQL: This is my java file:
For methods where ... there exists a static one-to-one mapping between the input and
I am trying to learn one to many Mapping in Hibernate . The below
I want to temporary store some mapping data. The mapping is one to one.
can any one provide me full 2 mapping file which implements cascade delete. measn
I am having a trouble mapping a specific URL request to one of the

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.