Working with my Seam example, just ported to 1.0.1.  Originally derived from 
the noejb example, which now became the Hibernate example.

I'm trying to declare a @Filter on one of my @Entities:
@Entity
  | @Name("blogPost")
  | @Filter(name="headOnly", condition="replicatedChangeset is null")
  | public class BlogPostImpl implements BlogPost, Serializable {
  |    private Long id;
  | ...
  |    @Id @GeneratedValue
  |    public Long getId()
  |    {
  |       return id;
  |    }
  | ...
  |    private Changeset replicatedChangeset;
  | 
  |    /**
  |     * The changeset in which this object was created.  Null for head 
objects; set for all
  |     * versioned copies.
  |     */
  |    @ManyToOne
  |    public Changeset getReplicatedChangeset ()
  |    {
  |       return replicatedChangeset;
  |    }
  | ...
  | }
And I'm trying to use it in a query like this (yes, this is basically trying to 
make a version-tracking blog-posting system):
      new Script() {
  | ...
  |          private Session database;
  |          @Override
  |          protected void updateModelValues()
  |          {
  |             database = (Session) Component.getInstance("database", true);
  |             assert database != null;
  |          }
  | 
  |          @Override
  |          protected void invokeApplication()
  |          {
  | ...
  |             database.enableFilter("headOnly");
  |             List<BlogPostImpl> headBlogPosts = database.createQuery("from 
BlogPostImpl").list();
  | ...
  |          }
  | 
  |       }.run();
The exception I get is that the "headOnly" filter is not found:
   [testng] FAILED: com.robjsoftware.replog.test.ChangesetTest.testChangeset()
  |    [testng] org.hibernate.HibernateException: No such filter configured 
[headOnly]
  |    [testng]     at 
org.hibernate.impl.SessionFactoryImpl.getFilterDefinition(SessionFactoryImpl.java:962)
  |    [testng]     at 
org.hibernate.impl.SessionImpl.enableFilter(SessionImpl.java:1025)
  |    [testng]     at 
com.robjsoftware.replog.test.ChangesetTest$4.invokeApplication(ChangesetTest.java:127)
What am I missing?  Is there any other magic I need to do to make @Filter work 
for a Seam @Entity?  Are there any known examples of trying this?  Should I 
even be expecting it to work?  Should I try moving this to hibernate.cfg.xml 
(since I do *have* a hibernate.cfg.xml)?  

The Hibernate startup debug spam mentions "Binding entity from annotated class: 
com.robjsoftware.replog.domain.BlogPostImpl" but doesn't mention any filter 
annotations.

Thanks very much -- I'm planning a bunch of aggressive weirdness with @Filters 
in this application, so it'll be a big bummer if Seam doesn't grok @Filter 
yet....
Cheers,
Rob 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3954234#3954234

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3954234

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to