Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.1.2
Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="au.com.groupware.profilemanager.model">
<class name="au.com.groupware.profilemanager.model.Person" table="PERSON">
<id name="id" column="PERSON_ID" type="integer" unsaved-value="null">
<generator class="native" />
</id>
<property name="firstName" column="FIRST_NAME" type="string" not-null="true" length="100" />
<property name="lastName" column="LAST_NAME" type="string" not-null="true" length="100" />
<property name="email" column="EMAIL" type="string" not-null="true" length="255" />
<property name="phone" column="PHONE" type="string" length="20" />
<property name="mobile" column="MOBILE" type="string" length="20" />
<property name="fax" column="FAX" type="string" length="20" />
<component name="address" class="au.com.groupware.profilemanager.model.Address">
<property name="streetAddress1" type="string" column="STREET_ADDRESS_1" />
<property name="streetAddress2" type="string" column="STREET_ADDRESS_2" />
<property name="city" type="string" column="CITY" />
<property name="postcode" type="string" column="POSTCODE" />
<many-to-one name="state" class="au.com.groupware.profilemanager.model.State" column="STATE_ID" not-null="false" />
</component>
<set name="organisationPeople" table="ORGANISATION_PERSON" lazy="true" cascade="delete-orphan" inverse="true">
<key column="PERSON_ID" />
<one-to-many class="au.com.groupware.profilemanager.model.OrganisationPerson" />
</set>
<joined-subclass name="au.com.groupware.profilemanager.model.User" table="USERS">
<key column="USER_ID" />
<property name="userName" column="USER_NAME" type="string" not-null="true" length="50" unique="true" />
<property name="password" column="PASSWORD" type="string" not-null="true" length="50" />
<property name="enabled" column="ENABLED" type="boolean" not-null="true" />
<set name="organisationsOwned" table="ORGANISATIONS" lazy="true" cascade="save-update" inverse="true">
<key column="USER_ID" />
<one-to-many class="au.com.groupware.profilemanager.model.Organisation" />
</set>
<set name="userRoles" table="USER_ROLE" lazy="true" cascade="all-delete-orphan" inverse="true">
<key column="USER_ID" />
<one-to-many class="au.com.groupware.profilemanager.model.UserRole" />
</set>
<set name="groupUsers" table="GROUP_USER" lazy="true" cascade="delete-orphan" inverse="true">
<key column="USER_ID" />
<one-to-many class="au.com.groupware.profilemanager.model.GroupUser" />
</set>
<set name="applicationAdministrators" table="APPLICATION_ADMINISTRATOR" lazy="true" cascade="none" inverse="true">
<key column="USER_ID" />
<one-to-many class="au.com.groupware.profilemanager.model.ApplicationAdministrator" />
</set>
<set name="organisationAdministrators" table="ORGANISATION_ADMINISTRATOR" lazy="true" cascade="none" inverse="true">
<key column="USER_ID" />
<one-to-many class="au.com.groupware.profilemanager.model.OrganisationAdministrator" />
</set>
<set name="groupAdministrators" table="GROUP_ADMINISTRATOR" lazy="true" cascade="none" inverse="true">
<key column="USER_ID" />
<one-to-many class="au.com.groupware.profilemanager.model.GroupAdministrator" />
</set>
<set name="passwordHistories" table="PASSWORD_HISTORY" lazy="true" cascade="all-delete-orphan" inverse="true">
<key column="USER_ID" />
<one-to-many class="au.com.groupware.profilemanager.model.PasswordHistory" />
</set>
<set name="requestsAsRequestor" table="REQUEST" lazy="true" cascade="save-update" inverse="true">
<key column="REQUESTOR_ID" />
<one-to-many class="au.com.groupware.profilemanager.model.Request" />
</set>
<set name="requestsAsActioner" table="REQUEST" lazy="true" cascade="save-update" inverse="true">
<key column="ACTIONER_ID" />
<one-to-many class="au.com.groupware.profilemanager.model.Request" />
</set>
<set name="requestsAsRequestorToProcess" table="REQUEST" lazy="true" cascade="save-update" inverse="true">
<key column="USER_ID" />
<one-to-many class="au.com.groupware.profilemanager.model.Request" />
</set>
</joined-subclass>
</class>
</hibernate-mapping>
The generated SQL (show_sql=true):Code:
DEBUG - UserDetailsServiceHibernate.loadUserByUsername(51) | loading user with userId 'Test Username 2'
DEBUG - UserManagerImpl.getUserForAuthentication(192) | getting user for authentication with id 'Test Username 2'
Hibernate: select this_.USER_ID as PERSON1_52_0_, this_1_.FIRST_NAME as FIRST2_52_0_, this_1_.LAST_NAME as LAST3_52_0_, this_1_.EMAIL as EMAIL52_0_, this_1_.PHONE as PHONE52_0_, this_1_.MOBILE as MOBILE52_0_, this_1_.FAX as FAX52_0_, this_1_.STREET_ADDRESS_1 as STREET8_52_0_, this_1_.STREET_ADDRESS_2 as STREET9_52_0_, this_1_.CITY as CITY52_0_, this_1_.POSTCODE as POSTCODE52_0_, this_1_.STATE_ID as STATE12_52_0_, this_.USER_NAME as USER2_53_0_, this_.PASSWORD as PASSWORD53_0_, this_.ENABLED as ENABLED53_0_ from USERS this_ inner join PERSON this_1_ on this_.USER_ID=this_1_.PERSON_ID where this_.USER_NAME=?
Hibernate: select this_.USER_ID as PERSON1_52_0_, this_1_.FIRST_NAME as FIRST2_52_0_, this_1_.LAST_NAME as LAST3_52_0_, this_1_.EMAIL as EMAIL52_0_, this_1_.PHONE as PHONE52_0_, this_1_.MOBILE as MOBILE52_0_, this_1_.FAX as FAX52_0_, this_1_.STREET_ADDRESS_1 as STREET8_52_0_, this_1_.STREET_ADDRESS_2 as STREET9_52_0_, this_1_.CITY as CITY52_0_, this_1_.POSTCODE as POSTCODE52_0_, this_1_.STATE_ID as STATE12_52_0_, this_.USER_NAME as USER2_53_0_, this_.PASSWORD as PASSWORD53_0_, this_.ENABLED as ENABLED53_0_ from USERS this_ inner join PERSON this_1_ on this_.USER_ID=this_1_.PERSON_ID where this_.USER_NAME=?
DEBUG - RoleManagerImpl.getCompleteRoleSetForUser(148) | getting complete role set for user with id '2'
Hibernate: select this_.ORGANISATION_ID as ORGANISA1_66_3_, this_.ORGANISATION_NAME as ORGANISA2_66_3_, this_.ABN as ABN66_3_, this_.WEBSITE_URL as WEBSITE4_66_3_, this_.ENABLED as ENABLED66_3_, this_.STREET_ADDRESS_1 as STREET6_66_3_, this_.STREET_ADDRESS_2 as STREET7_66_3_, this_.CITY as CITY66_3_, this_.POSTCODE as POSTCODE66_3_, this_.STATE_ID as STATE10_66_3_, this_.ORG_OWNER_USER_ID as ORG11_66_3_, this_.ORGANISATION_SUB_TYPE_ID as ORGANIS12_66_3_, organisati1_.ORGANISATION_PERSON_ID as ORGANISA1_70_0_, organisati1_.ORGANISATION_ID as ORGANISA2_70_0_, organisati1_.PERSON_ID as PERSON3_70_0_, organisati1_.DATE_MODIFIED as DATE4_70_0_, organisati4_.ORGANISATION_ID as ORGANISA1_66_1_, organisati4_.ORGANISATION_NAME as ORGANISA2_66_1_, organisati4_.ABN as ABN66_1_, organisati4_.WEBSITE_URL as WEBSITE4_66_1_, organisati4_.ENABLED as ENABLED66_1_, organisati4_.STREET_ADDRESS_1 as STREET6_66_1_, organisati4_.STREET_ADDRESS_2 as STREET7_66_1_, organisati4_.CITY as CITY66_1_, organisati4_.POSTCODE as POSTCODE66_1_, organisati4_.STATE_ID as STATE10_66_1_, organisati4_.ORG_OWNER_USER_ID as ORG11_66_1_, organisati4_.ORGANISATION_SUB_TYPE_ID as ORGANIS12_66_1_, person5_.PERSON_ID as PERSON1_52_2_, person5_.FIRST_NAME as FIRST2_52_2_, person5_.LAST_NAME as LAST3_52_2_, person5_.EMAIL as EMAIL52_2_, person5_.PHONE as PHONE52_2_, person5_.MOBILE as MOBILE52_2_, person5_.FAX as FAX52_2_, person5_.STREET_ADDRESS_1 as STREET8_52_2_, person5_.STREET_ADDRESS_2 as STREET9_52_2_, person5_.CITY as CITY52_2_, person5_.POSTCODE as POSTCODE52_2_, person5_.STATE_ID as STATE12_52_2_, person5_1_.USER_NAME as USER2_53_2_, person5_1_.PASSWORD as PASSWORD53_2_, person5_1_.ENABLED as ENABLED53_2_, case when person5_1_.USER_ID is not null then 1 when person5_.PERSON_ID is not null then 0 end as clazz_2_ from ORGANISATION this_ inner join ORGANISATION_PERSON organisati1_ on this_.ORGANISATION_ID=organisati1_.ORGANISATION_ID left outer join ORGANISATION organisati4_ on organisati1_.ORGANISATION_ID=organisati4_.ORGANISATION_ID left outer join PERSON person5_ on organisati1_.PERSON_ID=person5_.PERSON_ID left outer join USERS person5_1_ on person5_.PERSON_ID=person5_1_.USER_ID where this_.ENABLED=? and organisati1_.PERSON_ID=?
Hibernate: select this_.ORGANISATION_ID as ORGANISA1_66_3_, this_.ORGANISATION_NAME as ORGANISA2_66_3_, this_.ABN as ABN66_3_, this_.WEBSITE_URL as WEBSITE4_66_3_, this_.ENABLED as ENABLED66_3_, this_.STREET_ADDRESS_1 as STREET6_66_3_, this_.STREET_ADDRESS_2 as STREET7_66_3_, this_.CITY as CITY66_3_, this_.POSTCODE as POSTCODE66_3_, this_.STATE_ID as STATE10_66_3_, this_.ORG_OWNER_USER_ID as ORG11_66_3_, this_.ORGANISATION_SUB_TYPE_ID as ORGANIS12_66_3_, organisati1_.ORGANISATION_MEMBER_ID as ORGANISA1_68_0_, organisati1_.PARENT_ORGANISATION_ID as PARENT2_68_0_, organisati1_.CHILD_ORGANISATION_ID as CHILD3_68_0_, organisati1_.DATE_MODIFIED as DATE4_68_0_, organisati4_.ORGANISATION_ID as ORGANISA1_66_1_, organisati4_.ORGANISATION_NAME as ORGANISA2_66_1_, organisati4_.ABN as ABN66_1_, organisati4_.WEBSITE_URL as WEBSITE4_66_1_, organisati4_.ENABLED as ENABLED66_1_, organisati4_.STREET_ADDRESS_1 as STREET6_66_1_, organisati4_.STREET_ADDRESS_2 as STREET7_66_1_, organisati4_.CITY as CITY66_1_, organisati4_.POSTCODE as POSTCODE66_1_, organisati4_.STATE_ID as STATE10_66_1_, organisati4_.ORG_OWNER_USER_ID as ORG11_66_1_, organisati4_.ORGANISATION_SUB_TYPE_ID as ORGANIS12_66_1_, organisati5_.ORGANISATION_ID as ORGANISA1_66_2_, organisati5_.ORGANISATION_NAME as ORGANISA2_66_2_, organisati5_.ABN as ABN66_2_, organisati5_.WEBSITE_URL as WEBSITE4_66_2_, organisati5_.ENABLED as ENABLED66_2_, organisati5_.STREET_ADDRESS_1 as STREET6_66_2_, organisati5_.STREET_ADDRESS_2 as STREET7_66_2_, organisati5_.CITY as CITY66_2_, organisati5_.POSTCODE as POSTCODE66_2_, organisati5_.STATE_ID as STATE10_66_2_, organisati5_.ORG_OWNER_USER_ID as ORG11_66_2_, organisati5_.ORGANISATION_SUB_TYPE_ID as ORGANIS12_66_2_ from ORGANISATION this_ inner join ORGANISATION_MEMBER organisati1_ on this_.ORGANISATION_ID=organisati1_.PARENT_ORGANISATION_ID left outer join ORGANISATION organisati4_ on organisati1_.PARENT_ORGANISATION_ID=organisati4_.ORGANISATION_ID left outer join ORGANISATION organisati5_ on organisati1_.CHILD_ORGANISATION_ID=organisati5_.ORGANISATION_ID where this_.ENABLED=? and organisati1_.CHILD_ORGANISATION_ID in (?, ?)
Hibernate: select this_.ORGANISATION_ID as ORGANISA1_66_3_, this_.ORGANISATION_NAME as ORGANISA2_66_3_, this_.ABN as ABN66_3_, this_.WEBSITE_URL as WEBSITE4_66_3_, this_.ENABLED as ENABLED66_3_, this_.STREET_ADDRESS_1 as STREET6_66_3_, this_.STREET_ADDRESS_2 as STREET7_66_3_, this_.CITY as CITY66_3_, this_.POSTCODE as POSTCODE66_3_, this_.STATE_ID as STATE10_66_3_, this_.ORG_OWNER_USER_ID as ORG11_66_3_, this_.ORGANISATION_SUB_TYPE_ID as ORGANIS12_66_3_, organisati1_.ORGANISATION_MEMBER_ID as ORGANISA1_68_0_, organisati1_.PARENT_ORGANISATION_ID as PARENT2_68_0_, organisati1_.CHILD_ORGANISATION_ID as CHILD3_68_0_, organisati1_.DATE_MODIFIED as DATE4_68_0_, organisati4_.ORGANISATION_ID as ORGANISA1_66_1_, organisati4_.ORGANISATION_NAME as ORGANISA2_66_1_, organisati4_.ABN as ABN66_1_, organisati4_.WEBSITE_URL as WEBSITE4_66_1_, organisati4_.ENABLED as ENABLED66_1_, organisati4_.STREET_ADDRESS_1 as STREET6_66_1_, organisati4_.STREET_ADDRESS_2 as STREET7_66_1_, organisati4_.CITY as CITY66_1_, organisati4_.POSTCODE as POSTCODE66_1_, organisati4_.STATE_ID as STATE10_66_1_, organisati4_.ORG_OWNER_USER_ID as ORG11_66_1_, organisati4_.ORGANISATION_SUB_TYPE_ID as ORGANIS12_66_1_, organisati5_.ORGANISATION_ID as ORGANISA1_66_2_, organisati5_.ORGANISATION_NAME as ORGANISA2_66_2_, organisati5_.ABN as ABN66_2_, organisati5_.WEBSITE_URL as WEBSITE4_66_2_, organisati5_.ENABLED as ENABLED66_2_, organisati5_.STREET_ADDRESS_1 as STREET6_66_2_, organisati5_.STREET_ADDRESS_2 as STREET7_66_2_, organisati5_.CITY as CITY66_2_, organisati5_.POSTCODE as POSTCODE66_2_, organisati5_.STATE_ID as STATE10_66_2_, organisati5_.ORG_OWNER_USER_ID as ORG11_66_2_, organisati5_.ORGANISATION_SUB_TYPE_ID as ORGANIS12_66_2_ from ORGANISATION this_ inner join ORGANISATION_MEMBER organisati1_ on this_.ORGANISATION_ID=organisati1_.PARENT_ORGANISATION_ID left outer join ORGANISATION organisati4_ on organisati1_.PARENT_ORGANISATION_ID=organisati4_.ORGANISATION_ID left outer join ORGANISATION organisati5_ on organisati1_.CHILD_ORGANISATION_ID=organisati5_.ORGANISATION_ID where this_.ENABLED=? and organisati1_.CHILD_ORGANISATION_ID in (?)
Hibernate: select this_.ORGANISATION_ID as ORGANISA1_66_3_, this_.ORGANISATION_NAME as ORGANISA2_66_3_, this_.ABN as ABN66_3_, this_.WEBSITE_URL as WEBSITE4_66_3_, this_.ENABLED as ENABLED66_3_, this_.STREET_ADDRESS_1 as STREET6_66_3_, this_.STREET_ADDRESS_2 as STREET7_66_3_, this_.CITY as CITY66_3_, this_.POSTCODE as POSTCODE66_3_, this_.STATE_ID as STATE10_66_3_, this_.ORG_OWNER_USER_ID as ORG11_66_3_, this_.ORGANISATION_SUB_TYPE_ID as ORGANIS12_66_3_, organisati1_.ORGANISATION_MEMBER_ID as ORGANISA1_68_0_, organisati1_.PARENT_ORGANISATION_ID as PARENT2_68_0_, organisati1_.CHILD_ORGANISATION_ID as CHILD3_68_0_, organisati1_.DATE_MODIFIED as DATE4_68_0_, organisati4_.ORGANISATION_ID as ORGANISA1_66_1_, organisati4_.ORGANISATION_NAME as ORGANISA2_66_1_, organisati4_.ABN as ABN66_1_, organisati4_.WEBSITE_URL as WEBSITE4_66_1_, organisati4_.ENABLED as ENABLED66_1_, organisati4_.STREET_ADDRESS_1 as STREET6_66_1_, organisati4_.STREET_ADDRESS_2 as STREET7_66_1_, organisati4_.CITY as CITY66_1_, organisati4_.POSTCODE as POSTCODE66_1_, organisati4_.STATE_ID as STATE10_66_1_, organisati4_.ORG_OWNER_USER_ID as ORG11_66_1_, organisati4_.ORGANISATION_SUB_TYPE_ID as ORGANIS12_66_1_, organisati5_.ORGANISATION_ID as ORGANISA1_66_2_, organisati5_.ORGANISATION_NAME as ORGANISA2_66_2_, organisati5_.ABN as ABN66_2_, organisati5_.WEBSITE_URL as WEBSITE4_66_2_, organisati5_.ENABLED as ENABLED66_2_, organisati5_.STREET_ADDRESS_1 as STREET6_66_2_, organisati5_.STREET_ADDRESS_2 as STREET7_66_2_, organisati5_.CITY as CITY66_2_, organisati5_.POSTCODE as POSTCODE66_2_, organisati5_.STATE_ID as STATE10_66_2_, organisati5_.ORG_OWNER_USER_ID as ORG11_66_2_, organisati5_.ORGANISATION_SUB_TYPE_ID as ORGANIS12_66_2_ from ORGANISATION this_ inner join ORGANISATION_MEMBER organisati1_ on this_.ORGANISATION_ID=organisati1_.PARENT_ORGANISATION_ID left outer join ORGANISATION organisati4_ on organisati1_.PARENT_ORGANISATION_ID=organisati4_.ORGANISATION_ID left outer join ORGANISATION organisati5_ on organisati1_.CHILD_ORGANISATION_ID=organisati5_.ORGANISATION_ID where this_.ENABLED=? and organisati1_.CHILD_ORGANISATION_ID in (?, ?, ?)
Hibernate: select this_.GROUP_ID as GROUP1_59_3_, this_.GROUP_NAME as GROUP2_59_3_, this_.DESCRIPTION as DESCRIPT3_59_3_, groupuser1_.GROUP_USER_ID as GROUP1_58_0_, groupuser1_.GROUP_ID as GROUP2_58_0_, groupuser1_.USER_ID as USER3_58_0_, groupuser1_.DATE_MODIFIED as DATE4_58_0_, group4_.GROUP_ID as GROUP1_59_1_, group4_.GROUP_NAME as GROUP2_59_1_, group4_.DESCRIPTION as DESCRIPT3_59_1_, user5_.USER_ID as PERSON1_52_2_, user5_1_.FIRST_NAME as FIRST2_52_2_, user5_1_.LAST_NAME as LAST3_52_2_, user5_1_.EMAIL as EMAIL52_2_, user5_1_.PHONE as PHONE52_2_, user5_1_.MOBILE as MOBILE52_2_, user5_1_.FAX as FAX52_2_, user5_1_.STREET_ADDRESS_1 as STREET8_52_2_, user5_1_.STREET_ADDRESS_2 as STREET9_52_2_, user5_1_.CITY as CITY52_2_, user5_1_.POSTCODE as POSTCODE52_2_, user5_1_.STATE_ID as STATE12_52_2_, user5_.USER_NAME as USER2_53_2_, user5_.PASSWORD as PASSWORD53_2_, user5_.ENABLED as ENABLED53_2_ from GROUPS this_ inner join GROUP_USER groupuser1_ on this_.GROUP_ID=groupuser1_.GROUP_ID left outer join GROUPS group4_ on groupuser1_.GROUP_ID=group4_.GROUP_ID left outer join USERS user5_ on groupuser1_.USER_ID=user5_.USER_ID left outer join PERSON user5_1_ on user5_.USER_ID=user5_1_.PERSON_ID where groupuser1_.USER_ID=?
Hibernate: select this_.GROUP_ID as GROUP1_59_3_, this_.GROUP_NAME as GROUP2_59_3_, this_.DESCRIPTION as DESCRIPT3_59_3_, organisati1_.ORGANISATION_GROUP_ID as ORGANISA1_69_0_, organisati1_.ORGANISATION_ID as ORGANISA2_69_0_, organisati1_.GROUP_ID as GROUP3_69_0_, organisati1_.DATE_MODIFIED as DATE4_69_0_, organisati4_.ORGANISATION_ID as ORGANISA1_66_1_, organisati4_.ORGANISATION_NAME as ORGANISA2_66_1_, organisati4_.ABN as ABN66_1_, organisati4_.WEBSITE_URL as WEBSITE4_66_1_, organisati4_.ENABLED as ENABLED66_1_, organisati4_.STREET_ADDRESS_1 as STREET6_66_1_, organisati4_.STREET_ADDRESS_2 as STREET7_66_1_, organisati4_.CITY as CITY66_1_, organisati4_.POSTCODE as POSTCODE66_1_, organisati4_.STATE_ID as STATE10_66_1_, organisati4_.ORG_OWNER_USER_ID as ORG11_66_1_, organisati4_.ORGANISATION_SUB_TYPE_ID as ORGANIS12_66_1_, group5_.GROUP_ID as GROUP1_59_2_, group5_.GROUP_NAME as GROUP2_59_2_, group5_.DESCRIPTION as DESCRIPT3_59_2_ from GROUPS this_ inner join ORGANISATION_GROUP organisati1_ on this_.GROUP_ID=organisati1_.GROUP_ID left outer join ORGANISATION organisati4_ on organisati1_.ORGANISATION_ID=organisati4_.ORGANISATION_ID left outer join GROUPS group5_ on organisati1_.GROUP_ID=group5_.GROUP_ID where organisati1_.ORGANISATION_ID in (?, ?, ?, ?, ?, ?)
Hibernate: select this_.GROUP_ID as GROUP1_59_3_, this_.GROUP_NAME as GROUP2_59_3_, this_.DESCRIPTION as DESCRIPT3_59_3_, groupmembe1_.GROUP_MEMBER_ID as GROUP1_61_0_, groupmembe1_.PARENT_GROUP_ID as PARENT2_61_0_, groupmembe1_.CHILD_GROUP_ID as CHILD3_61_0_, groupmembe1_.DATE_MODIFIED as DATE4_61_0_, group4_.GROUP_ID as GROUP1_59_1_, group4_.GROUP_NAME as GROUP2_59_1_, group4_.DESCRIPTION as DESCRIPT3_59_1_, group5_.GROUP_ID as GROUP1_59_2_, group5_.GROUP_NAME as GROUP2_59_2_, group5_.DESCRIPTION as DESCRIPT3_59_2_ from GROUPS this_ inner join GROUP_MEMBER groupmembe1_ on this_.GROUP_ID=groupmembe1_.PARENT_GROUP_ID left outer join GROUPS group4_ on groupmembe1_.PARENT_GROUP_ID=group4_.GROUP_ID left outer join GROUPS group5_ on groupmembe1_.CHILD_GROUP_ID=group5_.GROUP_ID where groupmembe1_.CHILD_GROUP_ID in (?, ?, ?)
Hibernate: select this_.GROUP_ID as GROUP1_59_3_, this_.GROUP_NAME as GROUP2_59_3_, this_.DESCRIPTION as DESCRIPT3_59_3_, groupmembe1_.GROUP_MEMBER_ID as GROUP1_61_0_, groupmembe1_.PARENT_GROUP_ID as PARENT2_61_0_, groupmembe1_.CHILD_GROUP_ID as CHILD3_61_0_, groupmembe1_.DATE_MODIFIED as DATE4_61_0_, group4_.GROUP_ID as GROUP1_59_1_, group4_.GROUP_NAME as GROUP2_59_1_, group4_.DESCRIPTION as DESCRIPT3_59_1_, group5_.GROUP_ID as GROUP1_59_2_, group5_.GROUP_NAME as GROUP2_59_2_, group5_.DESCRIPTION as DESCRIPT3_59_2_ from GROUPS this_ inner join GROUP_MEMBER groupmembe1_ on this_.GROUP_ID=groupmembe1_.PARENT_GROUP_ID left outer join GROUPS group4_ on groupmembe1_.PARENT_GROUP_ID=group4_.GROUP_ID left outer join GROUPS group5_ on groupmembe1_.CHILD_GROUP_ID=group5_.GROUP_ID where groupmembe1_.CHILD_GROUP_ID in (?, ?)
Hibernate: select this_.ROLE_ID as ROLE1_56_3_, this_.ROLE_NAME as ROLE2_56_3_, this_.DESCRIPTION as DESCRIPT3_56_3_, this_.APPLICATION_ID as APPLICAT4_56_3_, grouprole1_.GROUP_ROLE_ID as GROUP1_57_0_, grouprole1_.GROUP_ID as GROUP2_57_0_, grouprole1_.ROLE_ID as ROLE3_57_0_, grouprole1_.DATE_MODIFIED as DATE4_57_0_, group4_.GROUP_ID as GROUP1_59_1_, group4_.GROUP_NAME as GROUP2_59_1_, group4_.DESCRIPTION as DESCRIPT3_59_1_, role5_.ROLE_ID as ROLE1_56_2_, role5_.ROLE_NAME as ROLE2_56_2_, role5_.DESCRIPTION as DESCRIPT3_56_2_, role5_.APPLICATION_ID as APPLICAT4_56_2_ from ROLES this_ inner join GROUP_ROLE grouprole1_ on this_.ROLE_ID=grouprole1_.ROLE_ID left outer join GROUPS group4_ on grouprole1_.GROUP_ID=group4_.GROUP_ID left outer join ROLES role5_ on grouprole1_.ROLE_ID=role5_.ROLE_ID where grouprole1_.GROUP_ID in (?, ?, ?, ?, ?)
Hibernate: select this_.ROLE_ID as ROLE1_56_3_, this_.ROLE_NAME as ROLE2_56_3_, this_.DESCRIPTION as DESCRIPT3_56_3_, this_.APPLICATION_ID as APPLICAT4_56_3_, userrole1_.USER_ROLE_ID as USER1_55_0_, userrole1_.USER_ID as USER2_55_0_, userrole1_.ROLE_ID as ROLE3_55_0_, userrole1_.DATE_MODIFIED as DATE4_55_0_, user4_.USER_ID as PERSON1_52_1_, user4_1_.FIRST_NAME as FIRST2_52_1_, user4_1_.LAST_NAME as LAST3_52_1_, user4_1_.EMAIL as EMAIL52_1_, user4_1_.PHONE as PHONE52_1_, user4_1_.MOBILE as MOBILE52_1_, user4_1_.FAX as FAX52_1_, user4_1_.STREET_ADDRESS_1 as STREET8_52_1_, user4_1_.STREET_ADDRESS_2 as STREET9_52_1_, user4_1_.CITY as CITY52_1_, user4_1_.POSTCODE as POSTCODE52_1_, user4_1_.STATE_ID as STATE12_52_1_, user4_.USER_NAME as USER2_53_1_, user4_.PASSWORD as PASSWORD53_1_, user4_.ENABLED as ENABLED53_1_, role5_.ROLE_ID as ROLE1_56_2_, role5_.ROLE_NAME as ROLE2_56_2_, role5_.DESCRIPTION as DESCRIPT3_56_2_, role5_.APPLICATION_ID as APPLICAT4_56_2_ from ROLES this_ inner join USER_ROLE userrole1_ on this_.ROLE_ID=userrole1_.ROLE_ID left outer join USERS user4_ on userrole1_.USER_ID=user4_.USER_ID left outer join PERSON user4_1_ on user4_.USER_ID=user4_1_.PERSON_ID left outer join ROLES role5_ on userrole1_.ROLE_ID=role5_.ROLE_ID where userrole1_.USER_ID=?
DEBUG - PersonController.secureFormBackingObject(84) | getting form backing object...
DEBUG - PersonManagerImpl.getPerson(106) | getting person with id '8'
Hibernate: select person0_.PERSON_ID as PERSON1_52_0_, person0_.FIRST_NAME as FIRST2_52_0_, person0_.LAST_NAME as LAST3_52_0_, person0_.EMAIL as EMAIL52_0_, person0_.PHONE as PHONE52_0_, person0_.MOBILE as MOBILE52_0_, person0_.FAX as FAX52_0_, person0_.STREET_ADDRESS_1 as STREET8_52_0_, person0_.STREET_ADDRESS_2 as STREET9_52_0_, person0_.CITY as CITY52_0_, person0_.POSTCODE as POSTCODE52_0_, person0_.STATE_ID as STATE12_52_0_, person0_1_.USER_NAME as USER2_53_0_, person0_1_.PASSWORD as PASSWORD53_0_, person0_1_.ENABLED as ENABLED53_0_, case when person0_1_.USER_ID is not null then 1 when person0_.PERSON_ID is not null then 0 end as clazz_0_ from PERSON person0_ left outer join USERS person0_1_ on person0_.PERSON_ID=person0_1_.USER_ID where person0_.PERSON_ID=?
DEBUG - UserManagerImpl.getUserByUserName(178) | getting user with userName 'Test Username 2'
Hibernate: select this_.USER_ID as PERSON1_52_0_, this_1_.FIRST_NAME as FIRST2_52_0_, this_1_.LAST_NAME as LAST3_52_0_, this_1_.EMAIL as EMAIL52_0_, this_1_.PHONE as PHONE52_0_, this_1_.MOBILE as MOBILE52_0_, this_1_.FAX as FAX52_0_, this_1_.STREET_ADDRESS_1 as STREET8_52_0_, this_1_.STREET_ADDRESS_2 as STREET9_52_0_, this_1_.CITY as CITY52_0_, this_1_.POSTCODE as POSTCODE52_0_, this_1_.STATE_ID as STATE12_52_0_, this_.USER_NAME as USER2_53_0_, this_.PASSWORD as PASSWORD53_0_, this_.ENABLED as ENABLED53_0_ from USERS this_ inner join PERSON this_1_ on this_.USER_ID=this_1_.PERSON_ID where this_.USER_NAME=?
Hibernate: select organisati0_.USER_ID as USER3_2_, organisati0_.ORGANISATION_ADMINISTRATOR_ID as ORGANISA1_2_, organisati0_.ORGANISATION_ADMINISTRATOR_ID as ORGANISA1_67_1_, organisati0_.ORGANISATION_ID as ORGANISA2_67_1_, organisati0_.USER_ID as USER3_67_1_, organisati0_.DATE_MODIFIED as DATE4_67_1_, organisati1_.ORGANISATION_ID as ORGANISA1_66_0_, organisati1_.ORGANISATION_NAME as ORGANISA2_66_0_, organisati1_.ABN as ABN66_0_, organisati1_.WEBSITE_URL as WEBSITE4_66_0_, organisati1_.ENABLED as ENABLED66_0_, organisati1_.STREET_ADDRESS_1 as STREET6_66_0_, organisati1_.STREET_ADDRESS_2 as STREET7_66_0_, organisati1_.CITY as CITY66_0_, organisati1_.POSTCODE as POSTCODE66_0_, organisati1_.STATE_ID as STATE10_66_0_, organisati1_.ORG_OWNER_USER_ID as ORG11_66_0_, organisati1_.ORGANISATION_SUB_TYPE_ID as ORGANIS12_66_0_ from ORGANISATION_ADMINISTRATOR organisati0_ inner join ORGANISATION organisati1_ on organisati0_.ORGANISATION_ID=organisati1_.ORGANISATION_ID where organisati0_.USER_ID=?
DEBUG - PersonValidator.validate(34) | entering validate method...
DEBUG - PersonValidator.validate(48) | validating email format...
DEBUG - PersonValidator.validate(71) | Validation passed...
DEBUG - AddressValidator.validate(55) | entering validate method...
DEBUG - AddressValidator.validate(103) | Validation passed...
DEBUG - SimpleFormController.processFormSubmission(257) | No errors -> processing submit
DEBUG - AbstractBaseFormController.onSubmit(118) | Found action method [protected org.springframework.web.servlet.ModelAndView au.com.groupware.profilemanager.web.controller.PersonController.saveAsUser(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,java.lang.Object,org.springframework.validation.BindException) throws java.lang.Exception]
DEBUG - PersonController.saveAsUser(172) | entering 'saveAsUser' method...
DEBUG - UserManagerImpl.encodeUserPassword(289) | setting password for new user
DEBUG - UserManagerImpl.logPasswordHistory(770) | logging user password history...
Hibernate: insert into PASSWORD_HISTORY (PASSWORD, USER_ID, DATE_PASSWORD_SET) values (?, ?, ?)
WARN - JDBCExceptionReporter.logExceptions(71) | SQL Error: 547, SQLState: 23000
ERROR - JDBCExceptionReporter.logExceptions(72) | INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FKFDEFF6D04D9A2450'. The conflict occurred in database 'ProfileManagerTest', table 'USERS', column 'USER_ID'.
DEBUG - StateManagerImpl.getStates(34) | getting states from database...
Hibernate: select top 1000 this_.STATE_ID as STATE1_64_0_, this_.STATE_NAME as STATE2_64_0_, this_.COUNTRY_ID as COUNTRY3_64_0_ from STATE this_
DEBUG - PersonController.setupReferenceData(247) | getting state list to populate select list...
Hi All,
I'm not sure if what i'm trying to do is possible or not. I have a class Person that has a joined-subclass of User. The User class extends Person by adding details for username, password and an enabled property. What i'm trying to do is convert an existing Person to a User. the approach i'm taking is this...
1. Get the Person from the database.
2. Instantiate a new User.
3. Using Bean Utils, copy all properties to the new User object from the Person
4. Give the user a userName, password and enabled property.
5. Evict the Person from the session
6. Save the User.
This is throwing exceptions at the database level as i've shown in the logs above. Am I going about this the write way ? Apart from the fact that it isn't working (yet) , i'm also a little concerned that Hibernate won't know how to deal with the collections in the Person.
thanks,
rob