anonymous wrote : And then, whenever the id of the object is available in a 
context variable or request parameter, we can just inject the correct instance.
Hi Gavin,
i have tried your approach with a ManagedHibernateEntity.
i must learn what the word 'whenever' means:
if the id is not available i get an exception
11:03:13,156 DEBUG org.jboss.seam.Component: instantiating Seam component: 
bazProject
  | 11:03:13,156 DEBUG org.jboss.seam.Component: initializing new instance of: 
bazProject
  | 11:03:13,218 DEBUG org.jboss.seam.Component: seam component not found: 
bazProjectID
  | 11:03:13,234 DEBUG org.hibernate.jdbc.JDBCContext: successfully registered 
Synchronization
  | java.lang.IllegalArgumentException: id to load is required for loading
  |     at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:51)
  |     at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:33)
  |     at org.hibernate.impl.SessionImpl.get(SessionImpl.java:796)
  |     at org.hibernate.impl.SessionImpl.get(SessionImpl.java:792)
  |     at 
org.jboss.seam.core.ManagedHibernateEntity.getInstance(ManagedHibernateEntity.java:52)
  | 
Does it make sense to you to write getInstance in this way?
  @Unwrap
  |    public Object getInstance() throws ClassNotFoundException
  |    {
  |       Class clazz = Class.forName(entityClass);
  |       if (id==null) return null;
  |       return session.get(clazz, id);
  |    }
  | 
Ciao,
Carsten

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959489
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to