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

  • Home
  • SEARCH
  • 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 7906227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:50:26+00:00 2026-06-03T10:50:26+00:00

i have a oneToMany and ManyToOne mapping in my models: class User @OneToMany (cascade

  • 0

i have a oneToMany and ManyToOne mapping in my models:

class User

@OneToMany (cascade = { CascadeType.REFRESH, CascadeType.DETACH }, fetch = FetchType.EAGER)
    private Set<Judgement> judgements;

class Judgement

@ManyToOne(cascade = { CascadeType.REFRESH, CascadeType.DETACH})
    @JoinColumn(name = "user_id")
    private User judge;

and in DB, i have to tables as Users and Judgements, when i tried to run my code, it showed error as:

Caused by: org.postgresql.util.PSQLException: ERROR: relation "users_judgements" does not exist

does that mean i have to create the table users_judgements by hand, jpa cannot automatically create the relationship for me? RoR can do it…Thanks.

  • 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-03T10:50:28+00:00Added an answer on June 3, 2026 at 10:50 am

    If you have a foreign key from USER table, user_id, in JUDGMENT table then there is no need to have another table. That will be the @JoinColumn(name = “user_id”).

    See if you are missing something; I can not see any “mappedBy” attribute, which will be “user” in your case.

    Please take a look at this article; page 4 that the link will take you, give details about one-to-many relationship. It will be worth reading the whole article.

    http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa2.html?page=4

    Also, the part 1 of the same tutorial is good for basics;

    http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html

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

Sidebar

Related Questions

I have an entity Bar : @OneToMany(cascade = CascadeType.ALL, mappedBy = bar) private Set<Foo>
I have a OneToMany relationship: public class Class1{ private String attr1; private String attr2;
I have Car and Rental models conntected OneToMany relation: @Entity public class Rental {
I have some problem with @OneToMany and @ManyToOne annotations. I have two class Suite
I have a class say: ClassA which has a collection of ClassB @OneToMany(cascade =
Hi I have the following class namespace MP\User\RegistrationBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection;
I have a one way @OneToMany relationship between a Team and Player class. I
I have the following entities: @Entity public class Owner{ @Id @Column(name = OWNER_ID) @OneToMany()
I have entities Country and City with relationship OneToMany from Country and ManyToOne from
I have this mapping: [Class(Table = foo, Name = Foo)] public class Foo {

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.