Hello,
I have question. When I try update object (Person) I have this error - could not reassociate uninitialized transient collection.
Could you please answer where I have exeption?
Person.hbm.xmlCode:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Attention: Generated code! Do not modify by hand!
Generated by: hibernate.hbm.xml.vsl in andromda-hibernate-cartridge.
-->
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-cascade="none">
<class name="com.adiakibur.groupware.entity.Person" table="PERSON" dynamic-insert="false" dynamic-update="false">
<id name="id" type="java.lang.Long" unsaved-value="null">
<column name="ID" sql-type="BIGINT"/>
<generator class="native">
</generator>
</id>
<property name="username" type="java.lang.String">
<column name="USERNAME" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="firstName" type="java.lang.String">
<column name="FIRST_NAME" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="lastName" type="java.lang.String">
<column name="LAST_NAME" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="password" type="java.lang.String">
<column name="PASSWORD" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="admin" type="boolean">
<column name="ADMIN" not-null="true" unique="false" sql-type="TINYINT"/>
</property>
<property name="email2" type="java.lang.String">
<column name="EMAIL2" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="homePhone" type="java.lang.String">
<column name="HOME_PHONE" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="workPhone" type="java.lang.String">
<column name="WORK_PHONE" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="cellPhone" type="java.lang.String">
<column name="CELL_PHONE" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="pager" type="java.lang.String">
<column name="PAGER" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="fax" type="java.lang.String">
<column name="FAX" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="address" type="java.lang.String">
<column name="ADDRESS" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="city" type="java.lang.String">
<column name="CITY" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="stateProv" type="java.lang.String">
<column name="STATE_PROV" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="postalCode" type="java.lang.String">
<column name="POSTAL_CODE" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="country" type="java.lang.String">
<column name="COUNTRY" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="webSite" type="java.lang.String">
<column name="WEB_SITE" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="companyName" type="java.lang.String">
<column name="COMPANY_NAME" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="title" type="java.lang.String">
<column name="TITLE" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="userFlag" type="boolean">
<column name="USER_FLAG" not-null="true" unique="false" sql-type="TINYINT"/>
</property>
<property name="addressLine2" type="java.lang.String">
<column name="ADDRESS_LINE2" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="workPhone2" type="java.lang.String">
<column name="WORK_PHONE2" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<property name="role" type="java.lang.String">
<column name="ROLE" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
</property>
<set name="memberships" order-by="PERSON_FK" lazy="true" fetch="select" inverse="true" cascade="delete">
<key foreign-key="MEMBERSHIP_PERSON_FKC">
<column name="PERSON_FK" sql-type="BIGINT"/>
</key>
<one-to-many class="com.adiakibur.groupware.entity.Membership"/>
</set>
<many-to-one name="company" class="com.adiakibur.groupware.entity.CompanyProfile" foreign-key="PERSON_COMPANY_FKC" lazy="proxy" fetch="select">
<column name="COMPANY_FK" not-null="false" sql-type="BIGINT"/>
</many-to-one>
<set name="messages" order-by="AUTHOR_FK" lazy="true" fetch="select" inverse="true" cascade="delete">
<key foreign-key="MESSAGE_AUTHOR_FKC">
<column name="AUTHOR_FK" sql-type="BIGINT"/>
</key>
<one-to-many class="com.adiakibur.groupware.entity.Message"/>
</set>
<set name="projects" order-by="CREATOR_FK" lazy="true" fetch="select" inverse="true" cascade="delete">
<key foreign-key="PROJECT_CREATOR_FKC">
<column name="CREATOR_FK" sql-type="BIGINT"/>
</key>
<one-to-many class="com.adiakibur.groupware.entity.Project"/>
</set>
<set name="personMessages" order-by="PERSON_FK" lazy="true" fetch="select" inverse="true">
<key foreign-key="PERSON_MESSAGE_PERSON_FKC">
<column name="PERSON_FK" sql-type="BIGINT"/>
</key>
<one-to-many class="com.adiakibur.groupware.entity.PersonMessage"/>
</set>
<set name="relationships" order-by="PERSON_FK" lazy="false" fetch="select" inverse="true" cascade="delete">
<key foreign-key="CONTACT_RELATIONSHIP_PERSON_FC">
<column name="PERSON_FK" sql-type="BIGINT"/>
</key>
<one-to-many class="com.adiakibur.groupware.entity.ContactRelationship"/>
</set>
<set name="contacts" order-by="OWNER_FK" lazy="false" fetch="select" inverse="true" cascade="delete">
<key foreign-key="CONTACT_RELATIONSHIP_OWNER_FKC">
<column name="OWNER_FK" sql-type="BIGINT"/>
</key>
<one-to-many class="com.adiakibur.groupware.entity.ContactRelationship"/>
</set>
<set name="fileDocuments" order-by="PERSON_FK" lazy="true" fetch="select" inverse="true">
<key foreign-key="FILE_DOCUMENT_PERSON_FKC">
<column name="PERSON_FK" sql-type="BIGINT"/>
</key>
<one-to-many class="com.adiakibur.groupware.entity.FileDocument"/>
</set>
<set name="imageComments" order-by="PERSON_FK" lazy="true" fetch="select" inverse="true">
<key foreign-key="IMAGE_COMMENT_PERSON_FKC">
<column name="PERSON_FK" sql-type="BIGINT"/>
</key>
<one-to-many class="com.adiakibur.groupware.entity.ImageComment"/>
</set>
<set name="imageNotes" order-by="PERSON_FK" lazy="true" fetch="select" inverse="true">
<key foreign-key="IMAGE_NOTE_PERSON_FKC">
<column name="PERSON_FK" sql-type="BIGINT"/>
</key>
<one-to-many class="com.adiakibur.groupware.entity.ImageNote"/>
</set>
<set name="calendars" order-by="OWNER_FK" lazy="true" fetch="select" inverse="true" cascade="delete">
<key foreign-key="CALENDAR_OWNER_FKC">
<column name="OWNER_FK" sql-type="BIGINT"/>
</key>
<one-to-many class="com.adiakibur.groupware.entity.Calendar"/>
</set>
<set name="sharedCalendars" order-by="PERSON_FK" lazy="true" fetch="select" inverse="true" cascade="delete">
<key foreign-key="SHARED_CALENDAR_PERSON_FKC">
<column name="PERSON_FK" sql-type="BIGINT"/>
</key>
<one-to-many class="com.adiakibur.groupware.entity.SharedCalendar"/>
</set>
<set name="personTags" order-by="PERSON_FK" lazy="false" fetch="select" inverse="false" cascade="all">
<key foreign-key="PERSON_TAG_PERSON_FKC">
<column name="PERSON_FK" sql-type="BIGINT"/>
</key>
<one-to-many class="com.adiakibur.groupware.entity.PersonTag"/>
</set>
</class>
</hibernate-mapping>
Person.javaCode:
package com.adiakibur.groupware.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.granite.tide.annotations.TideEnabled;
/**
*
*/
@Entity
@TideEnabled
public class Person
implements java.io.Serializable
{
/**
* The serial version UID of this class. Needed for serialization.
*/
private static final long serialVersionUID = -5727271188107911233L;
private java.lang.String username;
/**
*
*/
public java.lang.String getUsername()
{
return this.username;
}
public void setUsername(java.lang.String username)
{
this.username = username;
}
private java.lang.String firstName;
/**
*
*/
public java.lang.String getFirstName()
{
return this.firstName;
}
public void setFirstName(java.lang.String firstName)
{
this.firstName = firstName;
}
private java.lang.String lastName;
/**
*
*/
public java.lang.String getLastName()
{
return this.lastName;
}
public void setLastName(java.lang.String lastName)
{
this.lastName = lastName;
}
private java.lang.String password;
/**
*
*/
public java.lang.String getPassword()
{
return this.password;
}
public void setPassword(java.lang.String password)
{
this.password = password;
}
private boolean admin;
/**
*
*/
public boolean isAdmin()
{
return this.admin;
}
public void setAdmin(boolean admin)
{
this.admin = admin;
}
private java.lang.String email2;
/**
*
*/
public java.lang.String getEmail2()
{
return this.email2;
}
public void setEmail2(java.lang.String email2)
{
this.email2 = email2;
}
private java.lang.String homePhone;
/**
*
*/
public java.lang.String getHomePhone()
{
return this.homePhone;
}
public void setHomePhone(java.lang.String homePhone)
{
this.homePhone = homePhone;
}
private java.lang.String workPhone;
/**
*
*/
public java.lang.String getWorkPhone()
{
return this.workPhone;
}
public void setWorkPhone(java.lang.String workPhone)
{
this.workPhone = workPhone;
}
private java.lang.String cellPhone;
/**
*
*/
public java.lang.String getCellPhone()
{
return this.cellPhone;
}
public void setCellPhone(java.lang.String cellPhone)
{
this.cellPhone = cellPhone;
}
private java.lang.String pager;
/**
*
*/
public java.lang.String getPager()
{
return this.pager;
}
public void setPager(java.lang.String pager)
{
this.pager = pager;
}
private java.lang.String fax;
/**
*
*/
public java.lang.String getFax()
{
return this.fax;
}
public void setFax(java.lang.String fax)
{
this.fax = fax;
}
private java.lang.String address;
/**
*
*/
public java.lang.String getAddress()
{
return this.address;
}
public void setAddress(java.lang.String address)
{
this.address = address;
}
private java.lang.String city;
/**
*
*/
public java.lang.String getCity()
{
return this.city;
}
public void setCity(java.lang.String city)
{
this.city = city;
}
private java.lang.String stateProv;
/**
*
*/
public java.lang.String getStateProv()
{
return this.stateProv;
}
public void setStateProv(java.lang.String stateProv)
{
this.stateProv = stateProv;
}
private java.lang.String postalCode;
/**
*
*/
public java.lang.String getPostalCode()
{
return this.postalCode;
}
public void setPostalCode(java.lang.String postalCode)
{
this.postalCode = postalCode;
}
private java.lang.String country;
/**
*
*/
public java.lang.String getCountry()
{
return this.country;
}
public void setCountry(java.lang.String country)
{
this.country = country;
}
private java.lang.String webSite;
/**
*
*/
public java.lang.String getWebSite()
{
return this.webSite;
}
public void setWebSite(java.lang.String webSite)
{
this.webSite = webSite;
}
private java.lang.String companyName;
/**
*
*/
public java.lang.String getCompanyName()
{
return this.companyName;
}
public void setCompanyName(java.lang.String companyName)
{
this.companyName = companyName;
}
private java.lang.String title;
/**
*
*/
public java.lang.String getTitle()
{
return this.title;
}
public void setTitle(java.lang.String title)
{
this.title = title;
}
private boolean userFlag;
/**
*
*/
public boolean isUserFlag()
{
return this.userFlag;
}
public void setUserFlag(boolean userFlag)
{
this.userFlag = userFlag;
}
private java.lang.String addressLine2;
/**
*
*/
public java.lang.String getAddressLine2()
{
return this.addressLine2;
}
public void setAddressLine2(java.lang.String addressLine2)
{
this.addressLine2 = addressLine2;
}
private java.lang.String workPhone2;
/**
*
*/
public java.lang.String getWorkPhone2()
{
return this.workPhone2;
}
public void setWorkPhone2(java.lang.String workPhone2)
{
this.workPhone2 = workPhone2;
}
private java.lang.String role;
/**
*
*/
public java.lang.String getRole()
{
return this.role;
}
public void setRole(java.lang.String role)
{
this.role = role;
}
@Id @GeneratedValue
private java.lang.Long id;
/**
*
*/
public java.lang.Long getId()
{
return this.id;
}
public void setId(java.lang.Long id)
{
this.id = id;
}
private java.util.Collection memberships = new java.util.HashSet();
/**
*
*/
public java.util.Collection getMemberships()
{
return this.memberships;
}
public void setMemberships(java.util.Collection memberships)
{
this.memberships = memberships;
}
private com.adiakibur.groupware.entity.CompanyProfile company;
/**
*
*/
public com.adiakibur.groupware.entity.CompanyProfile getCompany()
{
return this.company;
}
public void setCompany(com.adiakibur.groupware.entity.CompanyProfile company)
{
this.company = company;
}
private java.util.Collection messages = new java.util.HashSet();
/**
*
*/
public java.util.Collection getMessages()
{
return this.messages;
}
public void setMessages(java.util.Collection messages)
{
this.messages = messages;
}
private java.util.Collection projects = new java.util.HashSet();
/**
*
*/
public java.util.Collection getProjects()
{
return this.projects;
}
public void setProjects(java.util.Collection projects)
{
this.projects = projects;
}
private java.util.Collection personMessages = new java.util.HashSet();
/**
*
*/
public java.util.Collection getPersonMessages()
{
return this.personMessages;
}
public void setPersonMessages(java.util.Collection personMessages)
{
this.personMessages = personMessages;
}
private java.util.Collection relationships = new java.util.HashSet();
/**
*
*/
public java.util.Collection getRelationships()
{
return this.relationships;
}
public void setRelationships(java.util.Collection relationships)
{
this.relationships = relationships;
}
private java.util.Collection contacts = new java.util.HashSet();
/**
*
*/
public java.util.Collection getContacts()
{
return this.contacts;
}
public void setContacts(java.util.Collection contacts)
{
this.contacts = contacts;
}
private java.util.Collection fileDocuments = new java.util.HashSet();
/**
*
*/
public java.util.Collection getFileDocuments()
{
return this.fileDocuments;
}
public void setFileDocuments(java.util.Collection fileDocuments)
{
this.fileDocuments = fileDocuments;
}
private java.util.Collection imageComments = new java.util.HashSet();
/**
*
*/
public java.util.Collection getImageComments()
{
return this.imageComments;
}
public void setImageComments(java.util.Collection imageComments)
{
this.imageComments = imageComments;
}
private java.util.Collection imageNotes = new java.util.HashSet();
/**
*
*/
public java.util.Collection getImageNotes()
{
return this.imageNotes;
}
public void setImageNotes(java.util.Collection imageNotes)
{
this.imageNotes = imageNotes;
}
private java.util.Collection calendars = new java.util.HashSet();
/**
*
*/
public java.util.Collection getCalendars()
{
return this.calendars;
}
public void setCalendars(java.util.Collection calendars)
{
this.calendars = calendars;
}
private java.util.Collection sharedCalendars = new java.util.HashSet();
/**
*
*/
public java.util.Collection getSharedCalendars()
{
return this.sharedCalendars;
}
public void setSharedCalendars(java.util.Collection sharedCalendars)
{
this.sharedCalendars = sharedCalendars;
}
private java.util.Collection personTags = new java.util.HashSet();
/**
*
*/
public java.util.Collection getPersonTags()
{
return this.personTags;
}
public void setPersonTags(java.util.Collection personTags)
{
this.personTags = personTags;
}
private int permissions = 0;
public void setPermissions(int val) {
this.permissions = val;
}
public int getPermissions() {
return permissions;
}
/**
* Returns <code>true</code> if the argument is an Person instance and all identifiers for this entity
* equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
*/
public boolean equals(Object object)
{
if (this == object)
{
return true;
}
if (!(object instanceof Person))
{
return false;
}
final Person that = (Person)object;
if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
{
return false;
}
return true;
}
/**
* Returns a hash code based on this entity's identifiers.
*/
public int hashCode()
{
int hashCode = 0;
hashCode = 29 * hashCode + (id == null ? 0 : id.hashCode());
return hashCode;
}
/**
* Constructs new instances of {@link com.adiakibur.groupware.entity.Person}.
*/
public static final class Factory
{
/**
* Constructs a new instance of {@link com.adiakibur.groupware.entity.Person}.
*/
public static com.adiakibur.groupware.entity.Person newInstance()
{
return new com.adiakibur.groupware.entity.Person();
}
/**
* Constructs a new instance of {@link com.adiakibur.groupware.entity.Person}, taking all required and/or
* read-only properties as arguments.
*/
public static com.adiakibur.groupware.entity.Person newInstance(java.lang.String username, java.lang.String firstName, java.lang.String lastName, java.lang.String password, boolean admin, java.lang.String email2, java.lang.String homePhone, java.lang.String workPhone, java.lang.String cellPhone, java.lang.String pager, java.lang.String fax, java.lang.String address, java.lang.String city, java.lang.String stateProv, java.lang.String postalCode, java.lang.String country, java.lang.String webSite, java.lang.String companyName, java.lang.String title, boolean userFlag)
{
final com.adiakibur.groupware.entity.Person entity = new com.adiakibur.groupware.entity.Person();
entity.setUsername(username);
entity.setFirstName(firstName);
entity.setLastName(lastName);
entity.setPassword(password);
entity.setAdmin(admin);
entity.setEmail2(email2);
entity.setHomePhone(homePhone);
entity.setWorkPhone(workPhone);
entity.setCellPhone(cellPhone);
entity.setPager(pager);
entity.setFax(fax);
entity.setAddress(address);
entity.setCity(city);
entity.setStateProv(stateProv);
entity.setPostalCode(postalCode);
entity.setCountry(country);
entity.setWebSite(webSite);
entity.setCompanyName(companyName);
entity.setTitle(title);
entity.setUserFlag(userFlag);
return entity;
}
/**
* Constructs a new instance of {@link com.adiakibur.groupware.entity.Person}, taking all possible properties
* (except the identifier(s))as arguments.
*/
public static com.adiakibur.groupware.entity.Person newInstance(java.lang.String username, java.lang.String firstName, java.lang.String lastName, java.lang.String password, boolean admin, java.lang.String email2, java.lang.String homePhone, java.lang.String workPhone, java.lang.String cellPhone, java.lang.String pager, java.lang.String fax, java.lang.String address, java.lang.String city, java.lang.String stateProv, java.lang.String postalCode, java.lang.String country, java.lang.String webSite, java.lang.String companyName, java.lang.String title, boolean userFlag, java.lang.String addressLine2, java.lang.String workPhone2, java.lang.String role, java.util.Collection memberships, com.adiakibur.groupware.entity.CompanyProfile company, java.util.Collection messages, java.util.Collection projects, java.util.Collection personMessages, java.util.Collection relationships, java.util.Collection contacts, java.util.Collection fileDocuments, java.util.Collection imageComments, java.util.Collection imageNotes, java.util.Collection calendars, java.util.Collection sharedCalendars, java.util.Collection personTags)
{
final com.adiakibur.groupware.entity.Person entity = new com.adiakibur.groupware.entity.Person();
entity.setUsername(username);
entity.setFirstName(firstName);
entity.setLastName(lastName);
entity.setPassword(password);
entity.setAdmin(admin);
entity.setEmail2(email2);
entity.setHomePhone(homePhone);
entity.setWorkPhone(workPhone);
entity.setCellPhone(cellPhone);
entity.setPager(pager);
entity.setFax(fax);
entity.setAddress(address);
entity.setCity(city);
entity.setStateProv(stateProv);
entity.setPostalCode(postalCode);
entity.setCountry(country);
entity.setWebSite(webSite);
entity.setCompanyName(companyName);
entity.setTitle(title);
entity.setUserFlag(userFlag);
entity.setAddressLine2(addressLine2);
entity.setWorkPhone2(workPhone2);
entity.setRole(role);
entity.setMemberships(memberships);
entity.setCompany(company);
entity.setMessages(messages);
entity.setProjects(projects);
entity.setPersonMessages(personMessages);
entity.setRelationships(relationships);
entity.setContacts(contacts);
entity.setFileDocuments(fileDocuments);
entity.setImageComments(imageComments);
entity.setImageNotes(imageNotes);
entity.setCalendars(calendars);
entity.setSharedCalendars(sharedCalendars);
entity.setPersonTags(personTags);
return entity;
}
}
// HibernateEntity.vsl merge-point
}
Thank you very much.