Re: EntityConverter
Wiki entry created.2006/7/23, Rogerio Pereira <[EMAIL PROTECTED]>: Matthias and Cagatay (Validator man):Sure! I'll add to myfaces wiki.2006/7/23, Cagatay Civici < [EMAIL PROTECTED]>: Hi,I'm an hibernate user and cannot think of using hibernate-jsf without an entity converter. We've also written one for our project. http://www.jroller.com/page/cenkcivici?entry=binding_made_easy_with_jsfAlso I've written a lookup data resolver to load all the data of the given class to a component as select items.As Matze said, a wiki would be great, I'll also add more Rogerio, Regards,CagatayOn 7/23/06, Matthias Wessendorf <[EMAIL PROTECTED]> wrote: Since I am not a hibernate user but thinking that can be sorta usfulfor other people,may I ask you to add this stuff to our wiki ?Thanks,On 7/22/06, Rogerio Pereira < [EMAIL PROTECTED]> wrote:> Hi guys!>> I created a EntityConverter that get the value entered by user in a UIInput> component and when the form is submited this value is converted to an > persistence layer entity that you can managed in you bean as u wish, can> work with persistence layers that provide a generic way to load entities, e.> g. Hibernate session.get(Class, Serializable). >> The only thing that u need to do is create a class that implement> EntityLoader (that belongs to EntityConverter package). And inside this> class u do this:>> public Object getEntity(Class type, Serializable id) { >> Session session = HibernateUtil.currentSession();>> Object object = session.get(type, id);>> return object;> }>> and then add this entry to your web.xml :>> > br.eti.faces.entityLoader>> br.gov.go.tj.scu.util.EntityLoader > >> using in your page:>>> > converter="#{entityConverter.entity['package.Entity;id']}"> > >var="entity" itemLabel="#{ entities.name}">itemValue="#{entity}" /> > > note: package.Entity is the full class name of your entity and id is the> name of your id property in your entity with their get/set methods>> reading the submited value in your bean: >> Entity entity = selectedEntity;>>> Uses a little of reflection but tries to do some caching on reflection stuff> to enhance performance.>> --> Yours truly (Atenciosamente), >> Rogério--Matthias Wessendorffurther stuff:blog: http://jroller.com/page/mwessendorf mail: mwessendorf-at-gmail-dot-com -- Yours truly (Atenciosamente),Rogério -- Yours truly (Atenciosamente),Rogério
Re: EntityConverter
Matthias and Cagatay (Validator man):Sure! I'll add to myfaces wiki.2006/7/23, Cagatay Civici <[EMAIL PROTECTED]>: Hi,I'm an hibernate user and cannot think of using hibernate-jsf without an entity converter. We've also written one for our project. http://www.jroller.com/page/cenkcivici?entry=binding_made_easy_with_jsfAlso I've written a lookup data resolver to load all the data of the given class to a component as select items.As Matze said, a wiki would be great, I'll also add more Rogerio, Regards,CagatayOn 7/23/06, Matthias Wessendorf <[EMAIL PROTECTED]> wrote: Since I am not a hibernate user but thinking that can be sorta usfulfor other people,may I ask you to add this stuff to our wiki ?Thanks,On 7/22/06, Rogerio Pereira < [EMAIL PROTECTED]> wrote:> Hi guys!>> I created a EntityConverter that get the value entered by user in a UIInput> component and when the form is submited this value is converted to an > persistence layer entity that you can managed in you bean as u wish, can> work with persistence layers that provide a generic way to load entities, e.> g. Hibernate session.get(Class, Serializable). >> The only thing that u need to do is create a class that implement> EntityLoader (that belongs to EntityConverter package). And inside this> class u do this:>> public Object getEntity(Class type, Serializable id) { >> Session session = HibernateUtil.currentSession();>> Object object = session.get(type, id);>> return object;> }>> and then add this entry to your web.xml :>> > br.eti.faces.entityLoader>> br.gov.go.tj.scu.util.EntityLoader > >> using in your page:>>> > converter="#{entityConverter.entity['package.Entity;id']}"> > >var="entity" itemLabel="#{ entities.name}">itemValue="#{entity}" /> > > note: package.Entity is the full class name of your entity and id is the> name of your id property in your entity with their get/set methods>> reading the submited value in your bean: >> Entity entity = selectedEntity;>>> Uses a little of reflection but tries to do some caching on reflection stuff> to enhance performance.>> --> Yours truly (Atenciosamente), >> Rogério--Matthias Wessendorffurther stuff:blog: http://jroller.com/page/mwessendorf mail: mwessendorf-at-gmail-dot-com -- Yours truly (Atenciosamente),Rogério
Re: EntityConverter
Hi,I'm an hibernate user and cannot think of using hibernate-jsf without an entity converter. We've also written one for our project. http://www.jroller.com/page/cenkcivici?entry=binding_made_easy_with_jsfAlso I've written a lookup data resolver to load all the data of the given class to a component as select items.As Matze said, a wiki would be great, I'll also add more Rogerio, Regards,CagatayOn 7/23/06, Matthias Wessendorf <[EMAIL PROTECTED]> wrote: Since I am not a hibernate user but thinking that can be sorta usfulfor other people,may I ask you to add this stuff to our wiki ?Thanks,On 7/22/06, Rogerio Pereira < [EMAIL PROTECTED]> wrote:> Hi guys!>> I created a EntityConverter that get the value entered by user in a UIInput> component and when the form is submited this value is converted to an > persistence layer entity that you can managed in you bean as u wish, can> work with persistence layers that provide a generic way to load entities, e.> g. Hibernate session.get(Class, Serializable). >> The only thing that u need to do is create a class that implement> EntityLoader (that belongs to EntityConverter package). And inside this> class u do this:>> public Object getEntity(Class type, Serializable id) { >> Session session = HibernateUtil.currentSession();>> Object object = session.get(type, id);>> return object;> }>> and then add this entry to your web.xml :>> > br.eti.faces.entityLoader>> br.gov.go.tj.scu.util.EntityLoader > >> using in your page:>>> > converter="#{entityConverter.entity['package.Entity;id']}"> > >var="entity" itemLabel="#{ entities.name}">itemValue="#{entity}" /> > > note: package.Entity is the full class name of your entity and id is the> name of your id property in your entity with their get/set methods>> reading the submited value in your bean: >> Entity entity = selectedEntity;>>> Uses a little of reflection but tries to do some caching on reflection stuff> to enhance performance.>> --> Yours truly (Atenciosamente), >> Rogério--Matthias Wessendorffurther stuff:blog: http://jroller.com/page/mwessendorfmail: mwessendorf-at-gmail-dot-com
Re: EntityConverter
Since I am not a hibernate user but thinking that can be sorta usful for other people, may I ask you to add this stuff to our wiki ? Thanks, On 7/22/06, Rogerio Pereira <[EMAIL PROTECTED]> wrote: Hi guys! I created a EntityConverter that get the value entered by user in a UIInput component and when the form is submited this value is converted to an persistence layer entity that you can managed in you bean as u wish, can work with persistence layers that provide a generic way to load entities, e. g. Hibernate session.get(Class, Serializable). The only thing that u need to do is create a class that implement EntityLoader (that belongs to EntityConverter package). And inside this class u do this: public Object getEntity(Class type, Serializable id) { Session session = HibernateUtil.currentSession(); Object object = session.get(type, id); return object; } and then add this entry to your web.xml : br.eti.faces.entityLoader br.gov.go.tj.scu.util.EntityLoader using in your page: note: package.Entity is the full class name of your entity and id is the name of your id property in your entity with their get/set methods reading the submited value in your bean: Entity entity = selectedEntity; Uses a little of reflection but tries to do some caching on reflection stuff to enhance performance. -- Yours truly (Atenciosamente), Rogério -- Matthias Wessendorf further stuff: blog: http://jroller.com/page/mwessendorf mail: mwessendorf-at-gmail-dot-com
EntityConverter
Hi guys!I created a EntityConverter that get the value entered by user in a UIInput component and when the form is submited this value is converted to an persistence layer entity that you can managed in you bean as u wish, can work with persistence layers that provide a generic way to load entities, e. g. Hibernate session.get(Class, Serializable).The only thing that u need to do is create a class that implement EntityLoader (that belongs to EntityConverter package). And inside this class u do this: public Object getEntity(Class type, Serializable id) { Session session = HibernateUtil.currentSession(); Object object = session.get(type, id); return object; }and then add this entry to your web.xml : br.eti.faces.entityLoader br.gov.go.tj.scu.util.EntityLoader using in your page: value="#{bean.selectedEntity}" converter="#{entityConverter.entity['package.Entity;id']}"> :selectItems value="#{bean.entities}" var="entity" itemLabel="#{ entities.name}" itemValue="#{entity}" /> </h:selectOneMenu> note: package.Entity is the full class name of your entity and id is the name of your id property in your entity with their get/set methodsreading the submited value in your bean:Entity entity = selectedEntity; Uses a little of reflection but tries to do some caching on reflection stuff to enhance performance.-- Yours truly (Atenciosamente),Rogério