-->
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.  [ 4 posts ] 
Author Message
 Post subject: .class property is inaccessible, Filters not working for me
PostPosted: Thu Jun 08, 2006 5:14 pm 
Newbie

Joined: Thu Jun 08, 2006 4:28 pm
Posts: 3
Filters in 3.1 don't work for me. Is it the order of my calls or the fact 'm doing 1-1 loading in a lazy fashion?

I've also noticed I can't do a named query with item.class. I get a parse error on it.


Hibernate version:

3.1

Mapping documents:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
  <class table="item" name="org.exussum.dkpmanager.Item">
    <id access="property" name="id">
      <generator class="native"/>
    </id>
    <many-to-one not-null="true" column="pool_id" access="property" name="pool"/>
    <property name="name" not-null="true" access="property"/>
  </class>
  <filter-def condition="unused &lt;&gt; true" name="item.filter.active"/>
  <filter-def condition="pool.id = :poolId" name="item.filter.pool.id">
    <filter-param type="integer" name="poolId"/>
  </filter-def>
</hibernate-mapping>


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

Code:
Filter filter = getSession().enableFilter("item.filter.pool.id");
filter.setParameter("poolId",
                    item.getPool().getId());
Query query = session.getNamedQuery("query_name_in_other.hbm");
List list = query.list();


Name and version of the database you are using:

MSSQL Server 2k

The generated SQL (show_sql=true):

select item0_.id as id3_, item0_.pool_id as pool4_3_, item0_.name as name3_ from item item0_ order by item0_.name

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 09, 2006 7:02 am 
Newbie

Joined: Thu Jun 08, 2006 4:28 pm
Posts: 3
Anyone?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 11, 2006 3:45 pm 
Newbie

Joined: Thu Jun 08, 2006 4:28 pm
Posts: 3
Anyone actually /have/ filters working?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 14, 2006 5:31 pm 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
We definitely have filters working, alot of our core architecture is built on them as a matter of fact, they are a god send.

IIRC, the filter-def is meant to simply provide the filter definition.

Within your class tags you should have:

<filter name="item.filter.pool.id"/>

Optionally you can have

<filter name="item.filter.pool.id" condition="some overridden condition"/>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.