Hi again, but i cant make it! :-((

i have this:


private ArrayList scheduleItems = new ArrayList();

List scheduleResult = session.createQuery("select s.id, s.description,
s.comments, s.endTime, s.startTime, s.subtitle, s.title, s.isAllDay from " +
                  "Schedule as s").list();
           
          session.getTransaction().commit();
        
          for(int i = 0; i < scheduleResult.size();i++){
                scheduleItems.add(new
SelectItem(scheduleResult.get(i).toString()));
                
                        entries.add(scheduleItems);
          }

why i cant make: entries.add(scheduleItems); ?  how do you thik i must do
it? i am out of ideas!!

the méthod loadEntries, load entries when one or more entries are introduced
right? so how to make to load  the entries that are in data base in the
start? 

tks for all.





Jurgen Lust-2 wrote:
> 
> 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 <[EMAIL PROTECTED]>:
>> >> >>
>> >> >>
>> >> >> 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.
>> >> >>
>> >> >>
>> >> > 
>> >> > 
>> >> 
>> > 
>> > 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Schedule-tomahawk-tf4192737.html#a11950501
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to