Search Results

Search found 6 results on 1 pages for 'blitzkr1eg'.

Page 1/1 | 1 

  • Delete element from Set

    - by Blitzkr1eg
    Hi. I have 2 classes Tema(Homework) and Disciplina (course), where a Course has a Set of homeworks. In Hibernate i have mapped this to a one-to-many associations like this: <class name="model.Disciplina" table="devgar_scoala.discipline" > <id name="id" > <generator class="increment"/> </id> <set name="listaTeme" table="devgar_scoala.teme"> <key column="Discipline_id" not-null="true" ></key> <one-to-many class="model.Tema" ></one-to-many> </set> </class> <class name="model.Tema" table="devgar_scoala.teme" > <id name="id"> <generator class="increment" /> </id> <property name="titlu" type="string" /> <property name="cerinta" type="binary"> <column name="cerinta" sql-type="blob" /> </property> </class> The problem is that it will add (insert rows in the table 'Teme') but it won't delete any rows and i get no exceptions thrown. Im using the merge() method.

    Read the article

  • Hibernate won't save into database

    - by Blitzkr1eg
    I mapped some classes to some tables with hibernate in java, i set hibernate to show SQL, it opens the session, it show that id does the SQL, it closes the session but there are no modifications to the database. Entity 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;} Mapping <hibernate-mapping default-cascade="all"> <class name="model.Profesor" table="devgar_scoala.profesori"> <id name="id" column="id"> <generator class="increment"/> </id> <set name="listaDiscipline" table="devgar_scoala.`profesori-discipline`"> <key column="Profesori_id" /> <many-to-many class="model.Disciplina" column="Discipline_id" /> </set> <property name="nume" column="Nume" type="string" /> <property name="prenume" column="Prenume" type="string" /> <property name="departament_id" column="Departamente_id" type="integer" /> </class> <class name="model.Grup" table="devgar_scoala.grupe"> <id name="id" unsaved-value="0"> <generator class="increment"/> </id> <set name="listaStudenti" table="devgar_scoala.`studenti-grupe`"> <key column="Grupe_id" /> <many-to-many column="Studenti_nrMatricol" class="model.Student" /> </set> <property name="nume" column="Grupa" type="string"/> <property name="programStudiu" column="progStudii_id" type="integer" /> </class> <class name="model.Disciplina" table="devgar_scoala.discipline" > <id name="id" > <generator class="increment"/> </id> <property name="denumire" column="Denumire" type="string"/> <property name="syllabus" type="string" column="Syllabus"/> <property name="schNotare" type="string" column="SchemaNotare"/> <set name="listaGrupuri" table="devgar_scoala.`Discipline-Grupe`"> <key column="Discipline_id" /> <many-to-many column="Grupe_id" class="model.Grup" /> </set> <set name="lectii" table="devgar_scoala.lectii"> <key column="Discipline_id" not-null="true"/> <one-to-many class="model.Lectie" /> </set> </class> The only 'funny' thing is that the Profesor object gets loaded not with/by Hibernate but with manual classic SQL Java. Thats why i save the Profesor object like this p - the manually loaded Profesor object Profesor p2 = (Profesor) session.merge(p); session.saveOrUpdate(p2); //flush session of course After this i get in the Java console: Hibernate: insert into devgar_scoala.grupe (Grupa, progStudii_id, id) values (?, ?, ?) but when i look into the database there are no new rows in the table Grupe (the Groups table)

    Read the article

  • Java static method parameters

    - by Blitzkr1eg
    Why does the following code return 100 100 1 1 1 and not 100 1 1 1 1 ? public class Hotel { private int roomNr; public Hotel(int roomNr) { this.roomNr = roomNr; } public int getRoomNr() { return this.roomNr; } static Hotel doStuff(Hotel hotel) { hotel = new Hotel(1); return hotel; } public static void main(String args[]) { Hotel h1 = new Hotel(100); System.out.print(h1.getRoomNr() + " "); Hotel h2 = doStuff(h1); System.out.print(h1.getRoomNr() + " "); System.out.print(h2.getRoomNr() + " "); h1 = doStuff(h2); System.out.print(h1.getRoomNr() + " "); System.out.print(h2.getRoomNr() + " "); } } Why does it appear to pass Hotel by-value to doStuff() ?

    Read the article

  • C Named pipe (fifo). Parent process gets stuck

    - by Blitzkr1eg
    I want to make a simple program, that fork, and the child writes into the named pipe and the parent reads and displays from the named pipe. The problem is that it enters the parent, does the first printf and then it gets weird, it doesn't do anything else, does not get to the second printf, it just ways for input in the console. #include <string.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> void main() { char t[100]; mkfifo("myfifo",777); pid_t pid; pid = fork(); if (pid==0) { //execl("fifo2","fifo2",(char*)0); char r[100]; printf("scrie2->"); scanf("%s",r); int fp; fp = open("myfifo",O_WRONLY); write(fp,r,99); close(fp); printf("exit kid \n"); exit(0); } else { wait(0); printf("entered parent \n"); // <- this it prints // whats below this line apparently its not being executed int fz; printf("1"); fz = open("myfifo",O_RDONLY); printf("2"); printf("fd: %d",fz); char p[100]; int size; printf("------"); //struct stat *info; //stat("myfifo",info); printf("%d",(*info).st_size); read(fz,p,99); close(fz); printf("%s",p); printf("exit"); exit(0); } }

    Read the article

  • How to improve my software project's speed?

    - by Blitzkr1eg
    I'm doing a school software project with my class mates in Java. We store the info on a remote db. When we start the application we pull all the information from the database and transform it into objects to use in our application (using java sql statemens). In the application we edit some of these objects and then when we exit the application we save or update information in the database using Hibernate. As you see we dont use Hibernate for pulling in information, we use it just for saving and updating. We have 2, but very similar problems. The loading of object(when we start the app) and the saving of objects(with Hibernate) in the db(when closing the app) is taking too much time. And our project its not a huge enterprise application, its a quite small app, we just manage some students, teachers, homeworks and tests. So our db is also very very small. How could we increase performance ? later edit: if we use a local database it runs very quick, it just runs slow on remote databases

    Read the article

1