(id, version, description, name, superior_pid, userName) See the log "- log with "SQLQueries" -" below.Ĭan anyone help me with an explanation on why the problem occurs when using "rge", and why it then does not occur when using corresponding "SQL inserts"? So all in all the SQL queries inserts the exact same data into the database as the "rge()" does, but now it does NOT fail. The user_pid = 14 corresponded to the user created in the first SQL, and groups_pid = 50 corresponds to the group added to the User in the real case. ![]() Q = session.createSQLQuery("insert into UserGroups (User_pid, groups_pid) values (14, 50)") SQLQuery q = session.createSQLQuery("insert into User (id, version, description, name, superior_pid, userName) values ('" + user.getID() + "', 0, '" + user.getDescription() + "', '" + user.getName() + "', null, '" + user.getUserName() + "')") I have tried execute the same statements using pure SQL: I cannot figure out why this error occurs. ![]() See the log "- log with "rge()" -" below. But the "insert into UserGroups" hangs for a long time and it all ends in an ": Lock wait timeout exceeded try restarting transaction"-exception. When the session is flushed/closed (when the Glassfish CMT closes i guess) an "insert into User" and a "insert into UserGroups" is invoked (as expected). Session session = sessionFactory.getCurrentSession() I want to save it with the following code: User contains a list of = "UserGroups")Īt one point in my application I have a new User object (user) that has an existing Group object in its list of groups. ![]() I have a User and a Group entity in my hibernate model. Using Hibernate Core 3.3.1.GA and Hibernate Annotations 3.4.0.GA on MySQL database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |