Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: @JoinFormula on @OneToMany
PostPosted: Tue Apr 24, 2012 4:10 pm 
Newbie

Joined: Sun Apr 01, 2012 8:28 pm
Posts: 3
I am trying to define @OneToMany with a @JoinFormula as follows:

Code:
@Entity
class Schedule {...}

@Entity
class Activity {
   @Id
   private Long id;

   @Getter
   @OneToMany(cascade = CascadeType.ALL)
   private Set<Schedule> schedule;

   @Getter
   @OneToMany(fetch=FetchType.LAZY)
   @Fetch(FetchMode.SELECT)
   @BatchSize(size=15)
   @JoinFormula(value = "SELECT s FROM Schedule s WHERE activity = id AND start > NOW()")
   private List<Schedule> futureSchedule;

   ...
}


Unfortunately, the JoinFormula has no effect and the query is never called. I tried to find documentation on the topic, but could hardly find anything. How can I achieve this behaviour?

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.