See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

Hibernate won't save into database

Course Queries Syllabus Queries

Max. 2000 characters



( 4 months ago )

I mapped some classes to some tables with hibernate in Java, i set Hibernate to show SQL, it opens the session, it shows that it does the SQL, it closes the session but there are no modifications to the database.


public class Profesor implements Comparable<Profesor> {
private int id;
private String nume;
private String prenume;
private int departament_id;
private Set<Disciplina> listaDiscipline; //the teacher gives some courses}

public class Disciplina implements Comparable<Disciplina>{ //the course class

private int id;
private String denumire;
private String syllabus;
private String schNotare;
private Set<Lectie> lectii;
private Set<Tema> listaTeme;
private Set<Grup> listaGrupuri; // the course gets teached/assigmened to some groups of students
private Set<Assignment> listAssignments;}


<hibernate-mapping default-cascade="all">
<class name="model.Profesor" table="devgar_scoala.profesori">
<id name="id" column="id">
 <generator class="increment"/>
<set name="listaDiscipline" table="devgar_scoala.`profesori-discipline`">
<key column="Profesori_id" />
<many-to-many class="model.Disciplina" column="Discipline_id"  />
<property name="nume" column="Nume" type="string" />
<property name="prenume" column="Prenume" type="string" />
<property name="departament_id" column="Departamente_id" type="integer" />

<class name="model.Grup" table="devgar_scoala.grupe">
<id name="id" unsaved-value="0">
<generator class="increment"/>
<set name="listaStudenti" table="devgar_scoala.`studenti-grupe`">

what's your interest