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.  [ 1 post ] 
Author Message
 Post subject: Criteria bag....or something else
PostPosted: Thu Aug 27, 2009 9:57 am 
Newbie

Joined: Wed Jul 22, 2009 8:40 am
Posts: 5
Hello, people!
I have one class and i map it to different tables (I do it by using entityname), but when i try to get data from one table, then i get it from all mapped tables. Please, tell me how to turn it off without building new SessionFactory! Thanks!
code:
Code:
......
var entName = ThisType.Name + ".TableRecordClass" + number;
var criteria = session.CreateCriteria(entName);
var sections = criteria.Add(Expression.Eq("ParentId", Id)).List<TableRecordClass>();

hbm:
    <class entity-name="ObjectType.TableRecordClass1" name="TableRecordClass" table="DirectoriesSection1">
    <id name="Id">
    <column name="Id" sql-type="bigint" not-null="true" />
    <generator class="native"></generator>
    </id>
    <property name="Name">
    <column name="Name" length="50" not-null="true" />
    </property>
    <property name="Type" />
    <property name="ParentId" />
    </class>

    <class entity-name="ObjectClass.TableRecordClass1" name="TableRecordClass" table="DocumentsSection1">
    <id name="Id">
    <column name="Id" sql-type="bigint" not-null="true" />
    <generator class="native"></generator>
    </id>
    <property name="Name">
    <column name="Name" length="50" not-null="true" />
    </property>
    <property name="Type" />
    <property name="ParentId" />
    </class>

    <class entity-name="ObjectClass.TableRecordClass2" name="TableRecordClass" table="DocumentsSection2">
    <id name="Id">
    <column name="Id" sql-type="bigint" not-null="true" />
    <generator class="native"></generator>
    </id>
    <property name="Name">
    <column name="Name" length="50" not-null="true" />
    </property>
    <property name="Type" />
    <property name="ParentId" />
    </class>


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

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.