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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:40:16+00:00 2026-06-10T11:40:16+00:00

My current Hibernate project is having some mapping problems. But first of all, I’ll

  • 0

My current Hibernate project is having some mapping problems. But first of all, I’ll tell that I’m using:

NetBeans 7.1.1
Java
JSF2
Oracle 10g
Apache Tomcat 7.0.22
Hibernate 3.2.1

I have to say that all the mapping classes were generated by the Hibernate Reverse Engeneering Wizard using Annotations, I mean, the classes were built from the tables at the database. I can run the program properly except the part regarding the insertion in a OneToMany relationship, this one:

Classes

Master

  @Entity
  @Table(name = "EXP_EXPEDIENTES")
  public class ExpExpedientes implements Serializable {

  @Id
  @SequenceGenerator(name = "seq", sequenceName = "EXP_SEQ") //Triggers are disabled so Hibernate can manage the sequence generation.
  @GeneratedValue(generator = "seq")
  @Column(name = "ID_EXP")
  private long idExpediente;

  @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
  private Set<ExpInstrucciones> expInstrucciones;    

  //more fields
  //getters & setters

Detail

  @Entity
  @Table(name = "EXP_INSTRUC")
  public class ExpInstrucciones implements Serializable {

  @Id
  @SequenceGenerator(name="seq",sequenceName="EXP_SEQ")
  @GeneratedValue(generator="seq")
  @Column(name = "ID_INS")
  private long idInstruccion;

  @ManyToOne(fetch=FetchType.LAZY)
  @JoinColumn(name="ID_EXP", nullable=false)
  private ExpExpedientes expExpedientes;

  //more fields
  //getters & setters

This way, I can make an ExpExpediente object and several ExpInstrucciones objects. After assigning some values and before trying to save them, I do:

  /* Previously, I've created these objects:
   * expInst_1 = new ExpInstruccines();
   * expInst_2 = new ExpInstrucciones();
   */ 

  expInst_1.setExpExpedientes(expExpediente);           
  expInst_2.setExpExpedientes(expExpediente);

  expExpediente.getExpInstrucciones().add(expInst_1);
  expExpediente.getExpInstrucciones().add(expInst_2);

  ExpedienteDAO.save(expExpediente);

The save method in the DAO class just consists on session.save(expExpediente). And here is where my problems come. Reading the sql generated by Hibernate, I could find out that the ORA-00942: table or view doesn’t exist error appears when Hibernate try to execute the next sentence:

  insert 
  into
      EXP_EXPEDIENTES_EXP_INSTRUC
      (EXP_EXPEDIENTES_ID_EXP, expInstrucciones_ID_INS) 
  values
      (?, ?)

I think the error is related to the table EXP_EXPEDIENTES_EXP_INSTRUC, which obviously does not exist in the database. In fact, the mapping was generated from the database, as I already said.

And now, my question: Am I supposed to create that table? Or all this issue is due to a misconfiguration problem? I really don’t know what to do, so any help will be 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-10T11:40:18+00:00Added an answer on June 10, 2026 at 11:40 am

    Your mapping should look like this:

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, 
       mappedBy = "expExpedientes")   
    private Set<ExpInstrucciones> expInstrucciones;     
    

    Sides of bidirectional relationship should be connected using mappedBy attribute on @OneToMany side, otherwise you’ll have two unidirectional relationships between ExpExpedientes and ExpInstrucciones, one of them implemented using foreign key and another one – using join table (by default).

    I guess it’s an error of Hibernate Reverse Engeneering Wizard, you should check other relationships for this problem as well.

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

Sidebar

Related Questions

I'm working on a java project full of Hibernate (3.3.1) mapping files that have
I am using springMVC and hibernate in my current j2ee project. The view as
Our current project does not use Hibernate (for various reasons) and we are using
I'm using two tables for my current project(it will grow certainly). First table has
My current setup using hibernate uses the hibernate.reveng.xml file to generate the various hbm.xml
I'm using nhibernate validator in my current solution. Everythings is almost fine but... My
I am working on a project for college that uses GWT, Hibernate and Gilead.
My C# project has repositories that are instantiated using dependency injection. One of the
This is my current project structure: pom.xml /src /main /resources hibernate.cfg.xml /META-INF persistence.xml I
We are using hibernateTemplate for our dao's within my current project. I have a

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.