- This topic has 2 replies, 2 voices, and was last updated 15 years, 2 months ago by dirkdiggler.
-
AuthorPosts
-
dirkdigglerMemberMy many-to-many mapping is doing a mysterious update. I think that it’s getting the data that I need on my query. Why would it try to do an update? I don’t call an update here at all…
"from User as model " + "where model.userName = '" + user.getUserName() + "' " + "and model.password = '" + user.getPassword() + "'";
The problem is that it attempts an update when it’s done & fails as there is not data in whatever it’s trying to store. Below is part of the stack trace & then my mappings…
20:24:57,030 DEBUG SQL:111 - /* update com.gtsyn.security.bean.Authorization */ update AUTHORIZATION set AUTH_NAME=?, DESCRIPTION=?, LAST_UPDATE=?, LAST_UPDATE_USER=?, APP_ID=? where AUTH_ID=? Hibernate: /* update com.gtsyn.security.bean.Authorization */ update AUTHORIZATION set AUTH_NAME=?, DESCRIPTION=?, LAST_UPDATE=?, LAST_UPDATE_USER=?, APP_ID=? where AUTH_ID=? 20:24:57,030 DEBUG AbstractBatcher:66 - Executing batch size: 1 20:24:57,061 DEBUG AbstractBatcher:418 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1) 20:24:57,061 DEBUG JDBCExceptionReporter:92 - Could not execute JDBC batch update [/* update com.gtsyn.security.bean.Authorization */ update AUTHORIZATION set AUTH_NAME=?, DESCRIPTION=?, LAST_UPDATE=?, LAST_UPDATE_USER=?, APP_ID=? where AUTH_ID=?] java.sql.BatchUpdateException: Column 'auth_name' cannot be null
<class name="User" table="APP_USER"> <id name="id" type="java.lang.Long"> <column name="USER_ID" precision="18" scale="0" /> <generator class="identity" /> </id> <property name="userName" type="string" column="USER_NAME" /> <property name="password" type="string" column="PASSWORD" /> <property name="activeDate" type="timestamp" column="ACTIVE_DATE" /> <property name="inactiveDate" type="timestamp" column="INACTIVE_DATE" /> <property name="createDate" type="timestamp" column="CREATE_DATE" update="false" /> <property name="createUser" type="string" column="CREATE_USER" update="false" /> <property name="lastUpdate" type="timestamp" column="LAST_UPDATE" /> <property name="lastUpdateUser" type="string" column="LAST_UPDATE_USER" /> <set name="auths" table="auth_user" lazy="false"> <key column="USER_ID"/> <many-to-many class="com.gtsyn.security.bean.Authorization" column="AUTH_ID" /> </set> </class> <class name="Application" table="APPLICATION"> <id name="id" type="java.lang.Long"> <column name="APP_ID" precision="18" scale="0" /> <generator class="identity" /> </id> <property name="appName" type="string" column="APP_NAME" /> <property name="description" type="string" column="DESCRIPTION" /> <property name="activeDate" type="timestamp" column="ACTIVE_DATE" /> <property name="inactiveDate" type="timestamp" column="INACTIVE_DATE" /> <property name="createDate" type="timestamp" column="CREATE_DATE" update="false" /> <property name="createUser" type="string" column="CREATE_USER" update="false" /> <property name="lastUpdate" type="timestamp" column="LAST_UPDATE" /> <property name="lastUpdateUser" type="string" column="LAST_UPDATE_USER" /> </class>
public class Authorization extends BaseBean { ... private Set users; public Set getUsers() { return users; } public void setUsers(Set users) { this.users = users; } ... } public class User extends BaseBean { ... private Set auths; public Set getAuths() { return auths; } public void setAuths(Set auths) { this.auths = auths; } ... }
support-shaliniMemberdirkdiggler,
Can you share your project? You can send a mail to support@genuitec.com. Please add ATTN: Shalini in the subject and refer to this thread. Also, can you send the script of the tables that you have used?
This will help us reproduce this issue internally and quickly work on resolution. Thanks for your help
dirkdigglerMemberas an update…
I have commented out all joins & am just trying to get data from this table. I have the same issue. Basically, it gets the data, then decides that the collection contains dirty elements & tries to update it. In my mind, I don’t care if object are dirty or not…how can you update if I don’t tell it to do so. And it seems to be trying to insert a blank record into it as the error that comes out is a “Column cannot be null” error.
Does *anyone* have any ideas? I am really stumped…
Travis
-
AuthorPosts