[jboss-user] [JBoss Seam] - Re: @Startup not working

quilleashm do-not-reply at jboss.com
Tue May 22 14:47:48 EDT 2007


In your example this


  | public void MySchedule()
  | 

Is wrong.  That's not a constructor it's a method.  Remove the void.

You can use the constructor method but a better way is to use the @Create annotation instead.


  | @Entity
  | @Name("mySchedule")
  | @Table(name="my_schedule")
  | @Scope(ScopeType.SESSION)
  | @Startup
  | public class MySchedule
  |     implements Serializable,
  | {
  | 
  |  @Create
  |  public void create()
  | {
  | MyScheduleHome msh = (MyScheduleHome) Component.getInstance("myScheduleHome");
  | msh.Schedule();
  | log.debug("Timer activated");
  | }
  | //Rest of the getters/setters for table.
  | ...
  | }
  | 

I would also suggest having @Entity and @Startup is bad practice.  Your entity object should be relatively clean and the scheduling code should probably be in a session bean that may inject/create the entity bean.

Cheers.

Mike.

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

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



More information about the jboss-user mailing list