Hallo zusammen!
Ich versuche verzweifelt einen Datensatz zu löschen, teilweise für hibernate das löschen auch aus, zumindest laufen die entsprechenden Funktionen fehlerfrei durch, doch auf der DB passiert nichts.
Wenn ich dann die selben Statements im SQL Worksheef ausführe fuktioniert es!
Das ganze wird von einem Session Bean im Jboss ausgeführt.
Andere Manipulationen der Daten sind erfolgreich, nur löschen kann ich den Eintrag nicht.
Hibernate version:
3.0.5
JBoss version:
4.0.2
Name and version of the database you are using:
Oracle9i 9.2.0.4
Mapping documents:
Mapping für AC_USER
Code:
<hibernate-mapping>
<class name="de.psb_gmbh.main.business.persistence.AcUser" table="AC_USER" schema="LAGERDBA">
<id name="UserId">
<column name="USER_ID"/>
<generator class="assigned" />
</id>
<many-to-one name="AcGroup" class="de.psb_gmbh.main.business.persistence.AcGroup">
<column name="MASTER_GROUP_ID"/>
</many-to-one>
<property name="LoginName">
<column name="LOGIN_NAME"/>
</property>
<property name="Name">
<column name="NAME"/>
</property>
<property name="Password">
<column name="PASSWORD"/>
</property>
<property name="CheckCount">
<column name="CHECK_COUNT"/>
</property>
[b] <set name="SetOfAcUserToGroup">
<key>
<column name="USER_ID" />
</key>
<one-to-many class="de.psb_gmbh.main.business.persistence.AcUserToGroup" />
</set>[/b]
</class>
</hibernate-mapping>
Mapping für AC_USER_TO_GROUPCode:
<hibernate-mapping>
<class name="de.psb_gmbh.main.business.persistence.AcUserToGroup" table="AC_USER_TO_GROUP" schema="LAGERDBA">
<composite-id name="id" class="de.psb_gmbh.main.business.persistence.AcUserToGroupId">
<key-many-to-one name="AcGroup" class="de.psb_gmbh.main.business.persistence.AcGroup">
<column name="GROUP_ID"/>
</key-many-to-one>
[b] <key-many-to-one name="AcUser" class="de.psb_gmbh.main.business.persistence.AcUser">
<column name="USER_ID"/>
</key-many-to-one>[/b]
</composite-id>
<property name="CheckCount">
<column name="CHECK_COUNT"/>
</property>
</class>
</hibernate-mapping>
AcUser.javaCode:
public class AcUser implements java.io.Serializable {
// Fields
private String UserId;
private AcGroup AcGroup;
private String LoginName;
private String Name;
private String Password;
private Integer CheckCount;
private Set<AcUserToGroup> SetOfAcUserToGroup;
// Constructors
public AcUser() {
}
// Property accessors
public String getUserId() {
return this.UserId;
}
public void setUserId(String UserId) {
this.UserId = UserId;
}
public AcGroup getAcGroup() {
return this.AcGroup;
}
public void setAcGroup(AcGroup AcGroup) {
this.AcGroup = AcGroup;
}
public String getLoginName() {
return this.LoginName;
}
public void setLoginName(String LoginName) {
this.LoginName = LoginName;
}
public String getName() {
return this.Name;
}
public void setName(String Name) {
this.Name = Name;
}
public String getPassword() {
return this.Password;
}
public void setPassword(String Password) {
this.Password = Password;
}
public Integer getCheckCount() {
return this.CheckCount;
}
public void setCheckCount(Integer CheckCount) {
this.CheckCount = CheckCount;
}
public Set<AcUserToGroup> getSetOfAcUserToGroup() {
return this.SetOfAcUserToGroup;
}
public void setSetOfAcUserToGroup(Set<AcUserToGroup> setOfAcUserToGroup) {
this.SetOfAcUserToGroup = setOfAcUserToGroup;
}
}
AcUserToGroup.javaCode:
public class AcUserToGroup implements java.io.Serializable {
// Fields
private de.psb_gmbh.main.business.persistence.AcUserToGroupId id;
private java.lang.Integer CheckCount;
// Constructors
public AcUserToGroup() {
}
// Property accessors
public AcUserToGroupId getId () {
return this.id;
}
public void setId (AcUserToGroupId id) {
this.id = id;
}
public Integer getCheckCount () {
return this.CheckCount;
}
public void setCheckCount (Integer CheckCount) {
this.CheckCount = CheckCount;
}
}
AcUserToGroupId.javaCode:
public class AcUserToGroupId implements java.io.Serializable {
// Fields
private AcGroup AcGroup;
private AcUser AcUser;
// Constructors
public AcUserToGroupId() {
}
// Property accessors
public de.psb_gmbh.main.business.persistence.AcGroup getAcGroup() {
return this.AcGroup;
}
public void setAcGroup(
de.psb_gmbh.main.business.persistence.AcGroup AcGroup) {
this.AcGroup = AcGroup;
}
public de.psb_gmbh.main.business.persistence.AcUser getAcUser() {
return this.AcUser;
}
public void setAcUser(de.psb_gmbh.main.business.persistence.AcUser AcUser) {
this.AcUser = AcUser;
}
Code between sessionFactory.openSession() and session.close():Code:
/** @ejb.interface-method view-type = "remote" */
public void deleteAcUser(String userId) throws BusinessException{
String msg = "AcUserMgrBean.deleteAcUser("+userId+")";
try {
hsession = factory.getCurrentSession();
hsession.createSQLQuery("DELETE FROM ac_user_to_group WHERE user_id='"+userId+"'");
hsession.createSQLQuery("DELETE FROM ac_user WHERE user_id='"+userId+"'");
log(msg);
} catch (Exception e) {
throw new BusinessException(msg, e.getCause());
}
}