-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: all database being retrieved on subclass while lazy="tr
PostPosted: Fri Feb 18, 2005 8:05 pm 
Newbie

Joined: Mon Dec 27, 2004 10:23 am
Posts: 7
Name and version of the database used: MySQL 4.0.15-max-debug

Hibernate version: 2.1.8

Others: Spring 1.1.4, AndroMDA-3RC1-SNAPSHOT

Hi,

Despite having set lazy to practically all my Associations, I get an horrible SQL query when I try to fetch data from my model.

It is (my model) rather complex. What I'm trying to do is have a Resource class, which references AccessRights objects (that's one of the rare occurence of an eagerly loaded Association). Many classes inherit from this base Resource class, which would supposedly allow me to check permissions for all the subclasses. That explains the rather lengthy xml below, but it's basically rather simple: check out the "Resource" class (the root class at the top), and for my specific problem, its "fractals.psychos.core.ontology.entity.PersonImpl" subclass.

Code between sessionFactory.openSession() and session.close():

I'm invoking a method on a Spring service, like this:

Code:
Criterion criterion = Expression.eq ("firstname", "Bernard");
resources.findResources (PersonImpl.class, bernard, new Criterion[]{criterion}, null);


The code in the DAO that is thence invoked follows:

Code:
  protected Collection handleFindResources (Class clazz, User user, Criterion[] criteria, Order[] orders) {
    try {
      Session session = getSession (false);
      Criteria crit = session.createCriteria (clazz);
      if (criteria!=null)
        for (int i=0; i<criteria.length; i++) crit.add (criteria[i]);
      if (orders!=null)
        for (int i=0; i<orders.length; i++) crit.addOrder (orders[i]);
     
      Criteria filter = crit.createCriteria ("accessRights");
     
      Criteria userFilter = filter.createCriteria ("user");
      userFilter.add (Expression.eq ("id", user.getId()));
     
      Criteria groupsFilter = filter.createCriteria ("group");
      Collection groups = user.getGroups();
      ArrayList groupIds = new ArrayList();
      if (groups!=null) {
        for (Iterator it=groups.iterator(); it.hasNext(); )
          groupIds.add(((UserGroup)it.next()).getId());
        groupsFilter.add (Expression.in ("id", groupIds));
      }
      filter.add (Expression.eq ("path", "/"));
      filter.add (Expression.sql ("{alias}.flags&?", Permissions.READ, Hibernate.INTEGER));
     
      return crit.list ();
    } catch (HibernateException he) {
      throw new RuntimeException (he);
    }
  }


And this is the SQL (which I can't afford to leave as is ;-):

The generated SQL:
Code:
Hibernate: select this.ID as ID14_, this.FIRSTNAME as FIRSTNAME14_, this.LASTNAME as LASTNAME14_, this.BIRTHDATE as BIRTHDATE14_, this.TIMESTAMP as TIMESTAMP14_, this.MIDDLE_NAME as MIDDLE_24_14_, this.PREDICATE_FK as PREDICAT4_14_, this.CORE_M_D_FK as CORE_M_D3_14_, predicatei1_.ID as ID0_, predicatei1_.URI as URI0_, predicatei1_.CORE_PREDICATE as CORE_PR32_0_, predicatei1_.OBJECT_FK as OBJECT_FK0_, predicatei1_.DESCRIPTION_FK as DESCRIP34_0_, predicatei1_.CORE_M_D_FK as CORE_M_D3_0_, abstractob2_.ID as ID1_, abstractob2_.class as class1_, abstractob2_.PREDICATE_FK as PREDICAT4_1_, abstractob2_.CORE_M_D_FK as CORE_M_D3_1_, abstractob2_.MEDIA_PATH as MEDIA_PATH1_, abstractob2_.ORIGINAL_MEDIA_PATH as ORIGINAL6_1_, abstractob2_.MEDIA_U_R_L as MEDIA_U_7_1_, abstractob2_.IS_REMOTE as IS_REMOTE1_, abstractob2_.TEXT as TEXT1_, abstractob2_.URI as URI1_, abstractob2_.STRING_VALUE as STRING_11_1_, abstractob2_.BOOLEAN_VALUE as BOOLEAN12_1_, abstractob2_.FLOAT_VALUE as FLOAT_V13_1_, abstractob2_.INT_VALUE as INT_VALUE1_, abstractob2_.DATE_VALUE as DATE_VALUE1_, abstractob2_.VALUE_TYPE as VALUE_TYPE1_, abstractob2_.PLACE_FK as PLACE_FK1_, abstractob2_.TIME_INFO_FK as TIME_IN18_1_, abstractob2_.RECURRING_EVENT_FK as RECURRI19_1_, abstractob2_.FIRSTNAME as FIRSTNAME1_, abstractob2_.LASTNAME as LASTNAME1_, abstractob2_.BIRTHDATE as BIRTHDATE1_, abstractob2_.TIMESTAMP as TIMESTAMP1_, abstractob2_.MIDDLE_NAME as MIDDLE_24_1_, abstractob2_.ADDRESS_FK as ADDRESS_FK1_, abstractob2_.LOCATION_FK as LOCATIO26_1_, abstractob2_.ORGANIZATION_FK as ORGANIZ27_1_, abstractob2_.TRACKS_FK as TRACKS_FK1_, abstractob2_.SUPER_ACTIVITY_FK as SUPER_A29_1_, abstractob2_.PERSON_FK as PERSON_FK1_, abstractob2_.ACTIVITY_FK as ACTIVIT31_1_, labelimpl3_.ID as ID2_, coremetada4_.ID as ID3_, coremetada4_.TYPE as TYPE3_, coremetada4_.LANGUAGE as LANGUAGE3_, coremetada4_.DATE_FK as DATE_FK3_, coremetada4_.TEMPORAL_COVERAGE_FK as TEMPORAL5_3_, coremetada4_.IDENTIFIER_FK as IDENTIFI6_3_, coremetada4_.PUBLISHER_FK as PUBLISHE7_3_, coremetada4_.CREATOR_FK as CREATOR_FK3_, coremetada5_.ID as ID4_, coremetada5_.TYPE as TYPE4_, coremetada5_.LANGUAGE as LANGUAGE4_, coremetada5_.DATE_FK as DATE_FK4_, coremetada5_.TEMPORAL_COVERAGE_FK as TEMPORAL5_4_, coremetada5_.IDENTIFIER_FK as IDENTIFI6_4_, coremetada5_.PUBLISHER_FK as PUBLISHE7_4_, coremetada5_.CREATOR_FK as CREATOR_FK4_, datetermim6_.ID as ID5_, datetermim6_.AVAILABLE_FK as AVAILABL2_5_, datetermim6_.DATE_CREATED_FK as DATE_CRE3_5_, datetermim6_.DATE_ACCEPTED_FK as DATE_ACC4_5_, datetermim6_.DATE_COPYRIGHTED_FK as DATE_COP5_5_, datetermim6_.DATE_SUBMITTED_FK as DATE_SUB6_5_, datetermim6_.VALID_FK as VALID_FK5_, datetermim6_.DATE_MODIFIED_FK as DATE_MOD8_5_, datetermim6_.DATE_ISSUED_FK as DATE_ISS9_5_, abstractte7_.ID as ID6_, abstractte7_.class as class6_, abstractte7_.START_TIME as START_TIME6_, abstractte7_.END_TIME as END_TIME6_, abstractte7_.TIME as TIME6_, resourceim8_.ID as ID7_, resourceim8_.class as class7_, resourceim8_.CORE_M_D_FK as CORE_M_D3_7_, resourceim8_.PREDICATE_FK as PREDICAT4_7_, resourceim8_.MEDIA_PATH as MEDIA_PATH7_, resourceim8_.ORIGINAL_MEDIA_PATH as ORIGINAL6_7_, resourceim8_.MEDIA_U_R_L as MEDIA_U_7_7_, resourceim8_.IS_REMOTE as IS_REMOTE7_, resourceim8_.TEXT as TEXT7_, resourceim8_.URI as URI7_, resourceim8_.STRING_VALUE as STRING_11_7_, resourceim8_.BOOLEAN_VALUE as BOOLEAN12_7_, resourceim8_.FLOAT_VALUE as FLOAT_V13_7_, resourceim8_.INT_VALUE as INT_VALUE7_, resourceim8_.DATE_VALUE as DATE_VALUE7_, resourceim8_.VALUE_TYPE as VALUE_TYPE7_, resourceim8_.PLACE_FK as PLACE_FK7_, resourceim8_.TIME_INFO_FK as TIME_IN18_7_, resourceim8_.RECURRING_EVENT_FK as RECURRI19_7_, resourceim8_.FIRSTNAME as FIRSTNAME7_, resourceim8_.LASTNAME as LASTNAME7_, resourceim8_.BIRTHDATE as BIRTHDATE7_, resourceim8_.TIMESTAMP as TIMESTAMP7_, resourceim8_.MIDDLE_NAME as MIDDLE_24_7_, resourceim8_.ADDRESS_FK as ADDRESS_FK7_, resourceim8_.LOCATION_FK as LOCATIO26_7_, resourceim8_.ORGANIZATION_FK as ORGANIZ27_7_, resourceim8_.TRACKS_FK as TRACKS_FK7_, resourceim8_.SUPER_ACTIVITY_FK as SUPER_A29_7_, resourceim8_.PERSON_FK as PERSON_FK7_, resourceim8_.ACTIVITY_FK as ACTIVIT31_7_, resourceim8_.CORE_PREDICATE as CORE_PR32_7_, resourceim8_.OBJECT_FK as OBJECT_FK7_, resourceim8_.DESCRIPTION_FK as DESCRIP34_7_, resourceim8_.DURATION as DURATION7_, resourceim8_.PERIODICITY as PERIODI36_7_, resourceim8_.STREET as STREET7_, resourceim8_.STREET2 as STREET27_, resourceim8_.NUMBER as NUMBER7_, resourceim8_.LOCALITY as LOCALITY7_, resourceim8_.COUNTRY as COUNTRY7_, resourceim8_.POST_CODE as POST_CODE7_, resourceim8_.NAME as NAME7_, resourceim8_.URL as URL7_, abstractid9_.ID as ID8_, userimpl10_.ID as ID9_, userimpl10_.USERNAME as USERNAME9_, userimpl10_.PASSWORD as PASSWORD9_, userimpl10_.PERSON_FK as PERSON_FK9_, userimpl10_.THUMBNAIL_FK as THUMBNAI5_9_, userimpl10_.CALENDAR_FK as CALENDAR6_9_, userimpl11_.ID as ID10_, userimpl11_.USERNAME as USERNAME10_, userimpl11_.PASSWORD as PASSWORD10_, userimpl11_.PERSON_FK as PERSON_FK10_, userimpl11_.THUMBNAIL_FK as THUMBNAI5_10_, userimpl11_.CALENDAR_FK as CALENDAR6_10_, x0_.ID as ID11_, x0_.FLAGS as FLAGS11_, x0_.PATH as PATH11_, x0_.NAME as NAME11_, x0_.CLAZZ as CLAZZ11_, x0_.GLOBAL as GLOBAL11_, x0_.IF_CREATOR as IF_CREATOR11_, x0_.GROUP_FK as GROUP_FK11_, x0_.USER_FK as USER_FK11_, x2_.ID as ID12_, x2_.NAME as NAME12_, x2_.TIMESTAMP as TIMESTAMP12_, x2_.DESCRIPTION_FK as DESCRIPT4_12_, x1_.ID as ID13_, x1_.USERNAME as USERNAME13_, x1_.PASSWORD as PASSWORD13_, x1_.PERSON_FK as PERSON_FK13_, x1_.THUMBNAIL_FK as THUMBNAI5_13_, x1_.CALENDAR_FK as CALENDAR6_13_ from RESOURCE this left outer join RESOURCE predicatei1_ on this.PREDICATE_FK=predicatei1_.ID left outer join RESOURCE abstractob2_ on predicatei1_.OBJECT_FK=abstractob2_.ID left outer join LABEL labelimpl3_ on predicatei1_.DESCRIPTION_FK=labelimpl3_.ID left outer join CORE_METADATA coremetada4_ on predicatei1_.CORE_M_D_FK=coremetada4_.ID left outer join CORE_METADATA coremetada5_ on this.CORE_M_D_FK=coremetada5_.ID left outer join DATE_TERM datetermim6_ on coremetada5_.DATE_FK=datetermim6_.ID left outer join ABSTRACT_TEMPORAL_ENCODING abstractte7_ on coremetada5_.TEMPORAL_COVERAGE_FK=abstractte7_.ID left outer join RESOURCE resourceim8_ on coremetada5_.ID=resourceim8_.ID left outer join ABSTRACT_IDENTIFIER abstractid9_ on coremetada5_.IDENTIFIER_FK=abstractid9_.ID left outer join USER userimpl10_ on coremetada5_.PUBLISHER_FK=userimpl10_.ID left outer join USER userimpl11_ on coremetada5_.CREATOR_FK=userimpl11_.ID inner join ACCESS_RIGHTS x0_ on this.ID=x0_.RESOURCE_FK inner join USER_GROUP x2_ on x0_.GROUP_FK=x2_.ID inner join USER x1_ on x0_.USER_FK=x1_.ID where this.FIRSTNAME=? and x1_.ID=? and x2_.ID in (?) and x0_.PATH=? and x0_.flags&? and this.class='PersonImpl'


It should be clear by reading what follows (again, please focus on the Resource, PersonImpl and AccessRight subclasses as those only are relevant to this case), that there is no reason whatsoever for all the Associations of the Resource class to be fetched as it is in the aforementioned SQL.

What can I do? Should I trash the whole idea of having a base Resource class control the permissions' checking mechanism?

bernard

Mapping documents:

Resource.hbm.xml:

Code:
<hibernate-mapping default-cascade="none">
    <class name="fractals.psychos.core.system.entity.ResourceImpl" table="RESOURCE">
        <id name="id" type="java.lang.Long" column="ID" unsaved-value="null">
            <generator class="native">
            </generator>
        </id>
        <discriminator column="class" type="string"/>
        <many-to-one name="coreMD" class="fractals.psychos.core.metadata.dc.entity.CoreMetadataImpl" outer-join="auto" unique="true" cascade="delete">
            <column name="CORE_M_D_FK"/>
        </many-to-one>
        <set name="userMD" order-by="RESOURCE_FK" lazy="true" outer-join="auto" inverse="false" cascade="delete">
            <key>
                <column name="RESOURCE_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.metadata.dc.entity.UserMetadataImpl"/>
        </set>
        <set name="accessRights" order-by="RESOURCE_FK" lazy="false" outer-join="auto" inverse="false" cascade="delete">
            <key>
                <column name="RESOURCE_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.system.entity.AccessRightsImpl"/>
        </set>
        <set name="properties" order-by="RESOURCE_FK" lazy="true" outer-join="auto" inverse="false">
            <key>
                <column name="RESOURCE_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.metadata.entity.PropertyImpl"/>
        </set>

        <subclass name="fractals.psychos.core.metadata.entity.AbstractObjectImpl" discriminator-value="AbstractObjectImpl">
        <many-to-one name="predicate" class="fractals.psychos.core.metadata.entity.PredicateImpl" outer-join="auto" unique="true">
            <column name="PREDICATE_FK"/>
        </many-to-one>

        <subclass name="fractals.psychos.core.media.entity.MediaImpl" discriminator-value="MediaImpl">
        <property name="mediaPath" type="java.lang.String">
            <column name="MEDIA_PATH" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="originalMediaPath" type="java.lang.String">
            <column name="ORIGINAL_MEDIA_PATH" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="mediaURL" type="java.lang.String">
            <column name="MEDIA_U_R_L" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="isRemote" type="boolean">
            <column name="IS_REMOTE" not-null="false" unique="false" sql-type="TINYINT"/>
        </property>

        <subclass name="fractals.psychos.core.media.entity.TextImpl" discriminator-value="TextImpl">
        <property name="text" type="java.lang.String">
            <column name="TEXT" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <set name="images" order-by="ARTICLE_FK" lazy="true" outer-join="auto" inverse="false">
            <key>
                <column name="ARTICLE_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.media.entity.ImageImpl"/>
        </set>

        </subclass>
        <subclass name="fractals.psychos.core.media.entity.AudioImpl" discriminator-value="AudioImpl">

        </subclass>
        <subclass name="fractals.psychos.core.media.entity.ThreeDImpl" discriminator-value="ThreeDImpl">

        </subclass>
        <subclass name="fractals.psychos.core.media.entity.VideoImpl" discriminator-value="VideoImpl">
        <set name="thumbnails" order-by="VIDEO_FK" lazy="true" outer-join="auto" inverse="false" cascade="delete">
            <key>
                <column name="VIDEO_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.media.entity.ImageImpl"/>
        </set>
        <set name="snapshots" order-by="VIDEO_FK" lazy="true" outer-join="auto" inverse="false">
            <key>
                <column name="VIDEO_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.media.entity.ImageImpl"/>
        </set>

        </subclass>
        <subclass name="fractals.psychos.core.media.entity.ImageGalleryImpl" discriminator-value="ImageGalleryImpl">
        <set name="images" order-by="IMAGE_GALLERY_FK" lazy="true" outer-join="auto" inverse="false">
            <key>
                <column name="IMAGE_GALLERY_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.media.entity.ImageImpl"/>
        </set>

        </subclass>
        <subclass name="fractals.psychos.core.media.entity.ImageImpl" discriminator-value="ImageImpl">
        <set name="thumbnails" order-by="IMAGE_FK" lazy="true" outer-join="auto" inverse="false" cascade="delete">
            <key>
                <column name="IMAGE_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.media.entity.ImageImpl"/>
        </set>

        </subclass>
        </subclass>
        <subclass name="fractals.psychos.core.metadata.entity.PropertyImpl" discriminator-value="PropertyImpl">
        <property name="uri" type="java.lang.String">
            <column name="URI" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="stringValue" type="java.lang.String">
            <column name="STRING_VALUE" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="booleanValue" type="boolean">
            <column name="BOOLEAN_VALUE" not-null="false" unique="false" sql-type="TINYINT"/>
        </property>
        <property name="floatValue" type="java.lang.Float">
            <column name="FLOAT_VALUE" not-null="false" unique="false" sql-type="FLOAT"/>
        </property>
        <property name="intValue" type="java.lang.Long">
            <column name="INT_VALUE" not-null="false" unique="false" sql-type="BIGINT"/>
        </property>
        <property name="dateValue" type="java.util.Date">
            <column name="DATE_VALUE" not-null="false" unique="false" sql-type="DATETIME"/>
        </property>
        <property name="valueType" type="int">
            <column name="VALUE_TYPE" not-null="false" unique="false" sql-type="INTEGER"/>
        </property>

        </subclass>
        <subclass name="fractals.psychos.core.ontology.entity.EventImpl" discriminator-value="EventImpl">
        <many-to-one name="place" class="fractals.psychos.core.ontology.entity.PlaceImpl" outer-join="auto" not-null="false" >
            <column name="PLACE_FK"/>
        </many-to-one>
        <many-to-one name="timeInfo" class="fractals.psychos.core.metadata.entity.AbstractTemporalEncodingImpl" outer-join="auto" unique="true" cascade="delete">
            <column name="TIME_INFO_FK"/>
        </many-to-one>

        <subclass name="fractals.psychos.core.ontology.entity.RecurringEventOccurenceImpl" discriminator-value="RecurringEventOccurenceImpl">
        <many-to-one name="recurringEvent" class="fractals.psychos.core.ontology.entity.RecurringEventImpl" outer-join="auto" not-null="false" >
            <column name="RECURRING_EVENT_FK"/>
        </many-to-one>

        </subclass>
        <subclass name="ubn.tv.lifestyle.entity.UBNEventImpl" discriminator-value="UBNEventImpl">

        </subclass>
        </subclass>
        <subclass name="fractals.psychos.core.ontology.entity.PersonImpl" discriminator-value="PersonImpl">
        <property name="firstname" type="java.lang.String">
            <column name="FIRSTNAME" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="lastname" type="java.lang.String">
            <column name="LASTNAME" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="birthdate" type="java.util.Date">
            <column name="BIRTHDATE" not-null="false" unique="false" sql-type="DATETIME"/>
        </property>
        <property name="timestamp" type="java.util.Date">
            <column name="TIMESTAMP" not-null="false" unique="false" sql-type="DATETIME"/>
        </property>
        <property name="middleName" type="java.lang.String">
            <column name="MIDDLE_NAME" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <set name="addresses" order-by="PERSON_FK" lazy="true" outer-join="auto" inverse="false" cascade="delete">
            <key>
                <column name="PERSON_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.ontology.entity.AddressImpl"/>
        </set>
        <set name="mainActivities" order-by="PERSON_FK" lazy="true" outer-join="auto" inverse="false">
            <key>
                <column name="PERSON_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.ontology.entity.ActivityImpl"/>
        </set>

        </subclass>
        <subclass name="fractals.psychos.core.ontology.entity.PlaceImpl" discriminator-value="PlaceImpl">
        <many-to-one name="address" class="fractals.psychos.core.ontology.entity.AddressImpl" outer-join="auto" unique="true" cascade="delete">
            <column name="ADDRESS_FK"/>
        </many-to-one>
        <set name="events" order-by="PLACE_FK" lazy="true" outer-join="auto" inverse="true">
            <key>
                <column name="PLACE_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.ontology.entity.EventImpl"/>
        </set>
        <many-to-one name="location" class="fractals.psychos.core.metadata.entity.AbstractSpatialEncodingImpl" outer-join="auto" unique="true" cascade="delete">
            <column name="LOCATION_FK"/>
        </many-to-one>

        <subclass name="ubn.tv.lifestyle.entity.ClubImpl" discriminator-value="ClubImpl">
        <many-to-one name="organization" class="fractals.psychos.core.ontology.entity.OrganisationImpl" outer-join="auto" unique="true">
            <column name="ORGANIZATION_FK"/>
        </many-to-one>

        </subclass>
        </subclass>
        <subclass name="ubn.tv.lifestyle.entity.AlbumImpl" discriminator-value="AlbumImpl">
        <many-to-one name="tracks" class="ubn.tv.lifestyle.entity.TrackImpl" outer-join="auto" cascade="delete" not-null="false" >
            <column name="TRACKS_FK"/>
        </many-to-one>

        </subclass>
        <subclass name="ubn.tv.lifestyle.entity.TrackImpl" discriminator-value="TrackImpl">

        </subclass>
        <subclass name="ubn.tv.lifestyle.entity.ProductionLabelImpl" discriminator-value="ProductionLabelImpl">

        </subclass>
        <subclass name="fractals.psychos.core.ontology.entity.ActivityImpl" discriminator-value="ActivityImpl">
        <many-to-one name="superActivity" class="fractals.psychos.core.ontology.entity.ActivityImpl" outer-join="auto" not-null="false" >
            <column name="SUPER_ACTIVITY_FK"/>
        </many-to-one>
        <set name="specializations" order-by="SUPER_ACTIVITY_FK" lazy="true" outer-join="auto" inverse="true">
            <key>
                <column name="SUPER_ACTIVITY_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.ontology.entity.ActivityImpl"/>
        </set>

        </subclass>
        <subclass name="fractals.psychos.core.ontology.entity.PerformerImpl" discriminator-value="PerformerImpl">
        <many-to-one name="person" class="fractals.psychos.core.ontology.entity.PersonImpl" outer-join="auto" unique="true" cascade="delete">
            <column name="PERSON_FK"/>
        </many-to-one>
        <many-to-one name="activity" class="fractals.psychos.core.ontology.entity.ActivityImpl" outer-join="auto" unique="true" cascade="delete">
            <column name="ACTIVITY_FK"/>
        </many-to-one>
        <many-to-one name="timeInfo" class="fractals.psychos.core.metadata.entity.AbstractTemporalEncodingImpl" outer-join="auto" unique="true" cascade="delete">
            <column name="TIME_INFO_FK"/>
        </many-to-one>

        </subclass>
        <subclass name="fractals.psychos.core.ontology.entity.OrganisationImpl" discriminator-value="OrganisationImpl">
        <set name="addresses" order-by="ORGANISATION_FK" lazy="true" outer-join="auto" inverse="false" cascade="delete">
            <key>
                <column name="ORGANISATION_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.ontology.entity.AddressImpl"/>
        </set>

        </subclass>
        </subclass>
        <subclass name="fractals.psychos.core.metadata.entity.PredicateImpl" discriminator-value="PredicateImpl">
        <property name="uri" type="java.lang.String">
            <column name="URI" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="corePredicate" type="boolean">
            <column name="CORE_PREDICATE" not-null="false" unique="false" sql-type="TINYINT"/>
        </property>
        <many-to-one name="object" class="fractals.psychos.core.metadata.entity.AbstractObjectImpl" outer-join="auto" unique="true">
            <column name="OBJECT_FK"/>
        </many-to-one>
        <many-to-one name="description" class="fractals.psychos.core.i18n.entity.LabelImpl" outer-join="auto" unique="true" cascade="delete">
            <column name="DESCRIPTION_FK"/>
        </many-to-one>

        </subclass>
        <subclass name="fractals.psychos.core.pim.entity.CalendarImpl" discriminator-value="CalendarImpl">
        <set name="events" table="CALENDARS_EVENTS" order-by="EVENTS_FK" outer-join="auto" lazy="true" inverse="false">
            <key>
                <column name="CALENDARS_FK"/>
            </key>
            <many-to-many class="fractals.psychos.core.ontology.entity.EventImpl" column="EVENTS_FK"/>
        </set>
        <one-to-one name="user" class="fractals.psychos.core.system.entity.UserImpl" outer-join="auto" property-ref="calendar"/>

        </subclass>
        <subclass name="fractals.psychos.core.ontology.entity.RecurringEventImpl" discriminator-value="RecurringEventImpl">
        <property name="duration" type="java.lang.Long">
            <column name="DURATION" not-null="false" unique="false" sql-type="BIGINT"/>
        </property>
        <property name="periodicity" type="java.lang.String">
            <column name="PERIODICITY" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <set name="occurences" order-by="RECURRING_EVENT_FK" lazy="true" outer-join="auto" inverse="true" cascade="delete">
            <key>
                <column name="RECURRING_EVENT_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.ontology.entity.RecurringEventOccurenceImpl"/>
        </set>

        </subclass>
        <subclass name="fractals.psychos.core.ontology.entity.AddressImpl" discriminator-value="AddressImpl">
        <property name="street" type="java.lang.String">
            <column name="STREET" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="street2" type="java.lang.String">
            <column name="STREET2" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="number" type="java.lang.String">
            <column name="NUMBER" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="locality" type="java.lang.String">
            <column name="LOCALITY" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="country" type="java.lang.String">
            <column name="COUNTRY" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="postCode" type="java.lang.String">
            <column name="POST_CODE" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>

        </subclass>
        <subclass name="fractals.psychos.core.system.entity.AppletImpl" discriminator-value="AppletImpl">
        <property name="name" type="java.lang.String">
            <column name="NAME" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="timestamp" type="java.util.Date">
            <column name="TIMESTAMP" not-null="false" unique="false" sql-type="DATETIME"/>
        </property>
        <property name="url" type="java.lang.String">
            <column name="URL" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <set name="icons" order-by="APPLET_FK" lazy="true" outer-join="auto" inverse="false" cascade="delete">
            <key>
                <column name="APPLET_FK"/>
            </key>
            <one-to-many class="fractals.psychos.core.media.entity.ImageImpl"/>
        </set>
        <many-to-one name="description" class="fractals.psychos.core.i18n.entity.LabelImpl" outer-join="auto" unique="true" cascade="delete">
            <column name="DESCRIPTION_FK"/>
        </many-to-one>

        </subclass>
    </class>
</hibernate-mapping>


AccessRights.hbm.xml:

Code:
<hibernate-mapping default-cascade="none">
    <class name="fractals.psychos.core.system.entity.AccessRightsImpl" table="ACCESS_RIGHTS">
        <id name="id" type="java.lang.Long" column="ID" unsaved-value="null">
            <generator class="native">
            </generator>
        </id>
        <property name="flags" type="int">
            <column name="FLAGS" not-null="false" unique="false" sql-type="INTEGER"/>
        </property>
        <property name="path" type="java.lang.String">
            <column name="PATH" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="name" type="java.lang.String">
            <column name="NAME" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="clazz" type="java.lang.String">
            <column name="CLAZZ" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
        </property>
        <property name="global" type="boolean">
            <column name="GLOBAL" not-null="false" unique="false" sql-type="TINYINT"/>
        </property>
        <property name="ifCreator" type="boolean">
            <column name="IF_CREATOR" not-null="false" unique="false" sql-type="TINYINT"/>
        </property>
        <many-to-one name="group" class="fractals.psychos.core.system.entity.UserGroupImpl" outer-join="auto" not-null="false" >
            <column name="GROUP_FK"/>
        </many-to-one>
        <many-to-one name="user" class="fractals.psychos.core.system.entity.UserImpl" outer-join="auto" not-null="false" >
            <column name="USER_FK"/>
        </many-to-one>

    </class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 18, 2005 11:50 pm 
Newbie

Joined: Mon Dec 27, 2004 10:23 am
Posts: 7
ok ok, it's the outer-join, stupid! I should've noticed this thing for long!!!

bernard


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.