myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jurgen Lust <Jurgen.L...@gmail.com>
Subject Re: Schedule tomahawk
Date Wed, 01 Aug 2007 14:21:59 GMT
Aha, I see your problem: you are returning a list of SelectItems, which
is wrong: you need a list of ScheduleEntry. You can find the source of
ScheduleEntry here:
http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/model/ScheduleEntry.java?revision=472638&view=markup

Make sure that the id property of each ScheduleEntry is unique. You can
use the database primary key for this.

Jurgen

Op woensdag 01-08-2007 om 06:42 uur [tijdzone -0700], schreef
ignicolist:
> Hi, first of all tks for your patience to me.
> 
> i have this in loadEntries:
> 
>  private ArrayList scheduleItems = new ArrayList();
> 
> if(scheduleItems.size() >=1){
>     		scheduleItems.clear();
>         }
>         if(scheduleItems.size() >= 1){
>         	scheduleItems.clear();
>         }
>         Session session =
> HibernateUtil.getSessionFactory().getCurrentSession();
>         session.beginTransaction();
>         
>         List scheduleResult = session.createQuery("select s.cod_evento,
> s.location, s.comments, s.end, s.start, s.title from " +
>                 "AddSchedule as s").list();
>          
>         session.getTransaction().commit();
>       
>         for(int i = 0; i < scheduleResult.size();i++){
>         	scheduleItems.add(new
> SelectItem(scheduleResult.get(i).toString()));
>         	
>         
> System.out.println("***"+((SelectItem)scheduleItems.get(i)).getLabel()+"***");
>         	
>         }
> 
> the scheduleItems actualy have values, the read from data base works, so why
> i cant just return scheduleItems variable? because i do that and donĀ“t work. 
> because the actual return variable is also a ArrayList. 
> 
> I real need this working, and i dont find anything to help me, its very few
> information about this case. So i real tks you for every explanation. And
> real good work you did to this component! =)
> 
> 
> 
> Jurgen Lust-2 wrote:
> > 
> > Hmm, I think the getCurrentSession() will fail, because normally there
> > is no hibernate session when you start a request. Also the transaction
> > stuff isn't required, since it is only a read operation.
> > 
> > Jurgen
> > 
> > Op woensdag 01-08-2007 om 03:00 uur [tijdzone -0700], schreef
> > ignicolist:
> >> Hi, this is my loadentries in SimplesScheduleModel.java, can i do  this?
> >> Is
> >> this correct? Because it give me error. I want to know if this is the
> >> correct thing to do.
> >> 
> >> 
> >> 
> >> protected Collection loadEntries(Date startDate, Date endDate)
> >>     {
> >> 
> >> Session session = HibernateUtil.getSessionFactory().getCurrentSession();
> >>         session.beginTransaction();
> >>         
> >>         List scheduleResult = session.createQuery("select s.cod_id,
> >> s.location, s.comments, s.end, s.start, s.title from " +
> >>                 "AddSchedule as s").list();
> >>          
> >>         session.getTransaction().commit();
> >>       
> >>         for(int i = 0; i < scheduleResult.size();i++){
> >>         	scheduleItems.add(new
> >> SelectItem(scheduleResult.get(i).toString()));
> >>         	
> >>      
> >>         }
> >>          
> >>          return scheduleItems;
> >>     
> >>     }
> >> 
> >> 
> >> Tks for all.
> >> 
> >> 
> >> 
> >> 
> >> 
> >> Jurgen Lust-2 wrote:
> >> > 
> >> > Hi,
> >> > 
> >> > In order to use a database as the source for the schedule, you need to
> >> > write
> >> > an implementation of the
> >> > org.apache.myfaces.custom.schedule.model.ScheduleModel interface. You
> >> can
> >> > extend the class
> >> > org.apache.myfaces.custom.schedule.model.AbstractScheduleModel for
> >> > convenience. Now you just need to implement the methods
> >> > loadEntries(Date,Date) and loadDayAttributes(Date). In the first
> >> method,
> >> > you
> >> > load the entries for the specified period of time from the database.
> >> > 
> >> > Jurgen
> >> > 
> >> > 2007/7/31, ignicolist <ignicolist@gmail.com>:
> >> >>
> >> >>
> >> >> Hi, i am making a project using myfaces schedule. and everything is
> >> >> working
> >> >> fine, but my problem is how i coud make the the entries of schedule
> >> could
> >> >> be
> >> >> read by a database?
> >> >>
> >> >> And how to put the views day,week and moth using the same model?
> >> Because
> >> >> if
> >> >> i use diferent models the entries in day view for example dont apear
> >> in
> >> >> month view!
> >> >> --
> >> >> View this message in context:
> >> >> http://www.nabble.com/Schedule-tomahawk-tf4192737.html#a11923285
> >> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> > 
> >> > 
> >> 
> > 
> > 
> 

Mime
View raw message