wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Can't not instance class... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Can Watch "Can New topic
Author

Can't not instance class...

Angel Fontanet
Greenhorn

Joined: Dec 06, 2006
Posts: 10
Good Morning

My situation is:'

I got this orm object

@hibernate.joined-subclass
* lazy="false"
* table="DIVISION"
* dynamic-update="true"
* dynamic-insert="true"
* @hibernate.joined-subclass-key
* column="PARTY_ROLE_ID"
*
public class Division extends OrganizationUnit implements IDivisionRole {


If you see this a child class, parents
of this class are:

/**
* @hibernate.joined-subclass
* lazy="false"
* table="ORGANIZATION_UNIT"
* dynamic-update="true"
* dynamic-insert="true"
* @hibernate.joined-subclass-key
* column="PARTY_ROLE_ID"
*
*
*
*/

public abstract class OrganizationUnit extends AbstractOrganizationRole {

-------------------------------------------------------------------------------------------
and
-------------------------------------------------------------------------------------------

/**
* @hibernate.joined-subclass
* lazy="false"
* table="ORGANIZATION_ROLE"
* dynamic-update="true"
* dynamic-insert="true"
* @hibernate.joined-subclass-key column="PARTY_ROLE_ID"
*
*
*/

public abstract class AbstractOrganizationRole extends AbstractPartyRole implements IOrganizationRole {


-------------------------------------------------------------------------------------------
and finally the parent
-------------------------------------------------------------------------------------------


/**
* @hibernate.class
* lazy="false"
* table="PARTY_ROLE"
* dynamic-update="true"
* dynamic-insert="true"
*
*/


public abstract class AbstractPartyRole implements IPartyRole,IPersistenceObject, Serializable {


So, the issue related to "can't not instance class INSURANCE_SUPPORT_STAFF" is


INSURANCE_SUPPORT_STAFF class is not a parent of DIVISION but some times, not all the times, only sometimes I got this error when I invoke DIVISION it wants to get also INSURANCE_SUPPORT_STAFF that it's not part of this parent herarqy.



This is the HBM



<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
<class
name="com.uig.unica.core.components.party.domain.orm.AbstractPartyRole"
table="PARTY_ROLE"
lazy="false"
dynamic-update="true"
dynamic-insert="true"
>

<id
name="ID"
column="PARTY_ROLE_ID"
type="java.lang.Long"
unsaved-value="null"
>
<generator class="sequence">
<param name="sequence">PARTY_SEQ</param>
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-AbstractPartyRole.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>

<many-to-one
name="party"
class="com.uig.unica.core.components.party.domain.orm.Party"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="PARTY_ID"
not-null="true"
/>

<many-to-one
name="roleType"
class="com.uig.unica.core.components.party.domain.orm.RoleType"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="ROLE_TYPE_ID"
not-null="true"
/>

<set
name="partyRelationshipFrom"
lazy="true"
inverse="true"
cascade="all"
sort="unsorted"
>

<key
column="PARTY_ROLE_ID_FROM"
>
</key>

<one-to-many
class="com.uig.unica.core.components.party.domain.orm.PartyRelationship"
/>

</set>

<set
name="partyRelationshipTo"
lazy="true"
inverse="true"
cascade="all"
sort="unsorted"
>

<key
column="PARTY_ROLE_ID_TO"
>
</key>

<one-to-many
class="com.uig.unica.core.components.party.domain.orm.PartyRelationship"
/>

</set>

<property
name="validFrom"
type="java.util.Date"
update="true"
insert="true"
column="VALID_FROM"
length="7"
not-null="true"
/>

<property
name="validThru"
type="java.util.Date"
update="true"
insert="true"
column="VALID_THRU"
/>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-AbstractPartyRole.xml
containing the additional properties and place it in your merge dir.
-->

<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.AbstractOrganizationRole"
table="ORGANIZATION_ROLE"
dynamic-update="true"
dynamic-insert="true"
lazy="false"
>
<key
column="PARTY_ROLE_ID"
/>

<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.InsuranceAgency"
table="INSURANCE_AGENCY"
dynamic-update="true"
dynamic-insert="true"
lazy="false"
>
<key
column="PARTY_ROLE_ID"
/>
<property
name="code"
type="java.lang.String"
update="true"
insert="true"
column="CODE"
length="28"
not-null="true"
/>

<property
name="imageRoute"
type="java.lang.String"
update="true"
insert="true"
column="IMAGE_ROUTE"
/>

<property
name="signatureRoute"
type="java.lang.String"
update="true"
insert="true"
column="SIGNATURE_ROUTE"
/>

</joined-subclass>
<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.Bank"
table="BANK"
dynamic-update="true"
dynamic-insert="true"
lazy="false"
>
<key
column="PARTY_ROLE_ID"
/>
<property
name="code"
type="java.lang.String"
update="true"
insert="true"
column="CODE"
length="28"
not-null="true"
/>

</joined-subclass>
<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.InsuranceProvider"
table="INSURANCE_PROVIDER"
dynamic-update="true"
dynamic-insert="true"
lazy="false"
>
<key
column="PARTY_ROLE_ID"
/>
<property
name="code"
type="java.lang.String"
update="true"
insert="true"
column="CODE"
length="28"
not-null="true"
/>

<property
name="imageRoute"
type="java.lang.String"
update="true"
insert="true"
column="image_route"
/>

<set
name="derramas"
lazy="true"
inverse="true"
cascade="all"
sort="unsorted"
>

<key
column="PARTY_ROLE_ID"
>
</key>

<one-to-many
class="com.uig.unica.core.components.party.domain.orm.Derrama"
/>

</set>

</joined-subclass>
<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.OrganizationUnit"
table="ORGANIZATION_UNIT"
dynamic-update="true"
dynamic-insert="true"
lazy="false"
>
<key
column="PARTY_ROLE_ID"
/>

<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.Division"
table="DIVISION"
dynamic-update="true"
dynamic-insert="true"
lazy="false"
>
<key
column="PARTY_ROLE_ID"
/>

</joined-subclass>

</joined-subclass>
<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.Dealer"
table="DEALER"
dynamic-update="true"
dynamic-insert="true"
lazy="false"
>
<key
column="PARTY_ROLE_ID"
/>
<property
name="code"
type="java.lang.String"
update="true"
insert="true"
column="CODE"
length="28"
not-null="true"
/>

</joined-subclass>

</joined-subclass>
<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.OrganizationRole"
table="ORGANIZATION_ROLE"
dynamic-update="true"
dynamic-insert="true"
>
<key
column="PARTY_ROLE_ID"
/>

</joined-subclass>
<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.AbstractPersonRole"
table="PERSON_ROLE"
dynamic-update="true"
dynamic-insert="true"
>
<key
column="PARTY_ROLE_ID"
/>

<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.InsuranceSupportStaff"
table="INSURANCE_SUPPORT_STAFF"
dynamic-update="true"
dynamic-insert="true"
>
<key
column="PARTY_ROLE_ID"
/>

<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.Supervisor"
table="SUPERVISER"
dynamic-update="true"
dynamic-insert="true"
>
<key
column="PARTY_ROLE_ID"
/>

</joined-subclass>
<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.Underwriter"
table="UNDERWRITER"
dynamic-update="true"
dynamic-insert="true"
>
<key
column="PARTY_ROLE_ID"
/>
<property
name="code"
type="java.lang.String"
update="true"
insert="true"
column="CODE"
length="28"
not-null="true"
/>

</joined-subclass>
<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.WFTaskApprover"
table="WF_TASK_APPROVER"
dynamic-update="true"
dynamic-insert="true"
>
<key
column="PARTY_ROLE_ID"
/>

</joined-subclass>
<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.Producer"
table="PRODUCER"
dynamic-update="true"
dynamic-insert="true"
>
<key
column="PARTY_ROLE_ID"
/>
<property
name="code"
type="java.lang.String"
update="true"
insert="true"
column="CODE"
length="28"
not-null="true"
/>

</joined-subclass>
<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.WFTaskDelegate"
table="WF_TASK_DELEGATE"
dynamic-update="true"
dynamic-insert="true"
>
<key
column="PARTY_ROLE_ID"
/>

</joined-subclass>

</joined-subclass>
<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.InsuranceAgent"
table="INSURANCE_AGENT"
dynamic-update="true"
dynamic-insert="true"
>
<key
column="PARTY_ROLE_ID"
/>
<property
name="code"
type="java.lang.String"
update="true"
insert="true"
column="CODE"
length="28"
not-null="true"
/>

</joined-subclass>
<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.Prospect"
table="PROSPECT"
dynamic-update="true"
dynamic-insert="true"
>
<key
column="PARTY_ROLE_ID"
/>

</joined-subclass>
<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.Employee"
table="EMPLOYEE"
dynamic-update="true"
dynamic-insert="true"
>
<key
column="PARTY_ROLE_ID"
/>

</joined-subclass>
<joined-subclass
name="com.uig.unica.core.components.party.domain.orm.Driver"
table="DRIVER"
dynamic-update="true"
dynamic-insert="true"
>
<key
column="PARTY_ROLE_ID"
/>
<property
name="licNumber"
type="java.lang.String"
update="true"
insert="true"
column="LICNUMBER"
length="12"
/>

<property
name="expDate"
type="java.util.Date"
update="true"
insert="true"
column="EXP_DATE"
length="12"
/>

<property
name="effDate"
type="java.util.Date"
update="true"
insert="true"
column="EFF_DATE"
length="12"
/>

</joined-subclass>

</joined-subclass>

</class>

</hibernate-mapping>



Thanks for help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can't not instance class...
 
Similar Threads
Hibernate- one-to-many association on a foreign key
Problem with reading field in Hibernate
Concurrent updates does not throw any exception
If somebody can translate this for me please?
hbm.xml file does an update instead of an insert- Helppppp