RE: how to use HibernateEntityValueEncoder
Hey Joakim... I tried your suggestion... and it worked. I actually created an interface with a host of default methods that I am forcing down the hierarchy... one of which is displayableName. And I made it past the tapestry code... final PropertyAdapter propertyAdapter = classPropertyAdapter.getPropertyAdapter(labelProperty); final ValueEncoder encoder = this.valueEncoderSource.getValueEncoder(propertyAdapter.getType()); propertyAdapter is not null anymore... and so I am able to get my encoder successfully now. Thanks a bunch... - ciao KEN public interface IAbstractEntity { @NonVisual @PropertyDescriptor(nonVisual = true, searchable = false) public Long getCreated(); @NonVisual @PropertyDescriptor(nonVisual = true, searchable = false) public Long getAccessed(); @NonVisual @PropertyDescriptor(nonVisual = true, searchable = false) public void setCreated(Long created); @NonVisual @PropertyDescriptor(nonVisual = true, searchable = false) public void setAccessed(Long accessed); @Transient @PropertyDescriptor(nonVisual = true, searchable = false) public String getCreatedAsString(); @Transient @PropertyDescriptor(nonVisual = true, searchable = false) public String getAccessedAsString(); @Transient @PropertyDescriptor(nonVisual = true, searchable = false) public void setCreatedAsString(String value) throws Exception; @Transient @PropertyDescriptor(nonVisual = true, searchable = false) public void setAccessedAsString(String value) throws Exception; public String getDisplayableName(); public void setDisplayableName(String displayableName); public int hashCode(); public boolean equals(Object obj); public String toString(); }
RE: how to use HibernateEntityValueEncoder
Joakim, Thank you for the suggestion. I was hoping for checkins on the framework I use but non yet. I am stuck until that happens. But I can unit test while stuck. I will try your suggestion... making a get/set displayableString() and just put toString() inside of it. The tapestry framework should consider using toString as the default for objects populating and contained options by default. I will let you know the result. Have a good day friend Ken
Re: how to use HibernateEntityValueEncoder
On Thu, 16 May 2013 15:55:39 -0300, Ken in Nashua wrote: So it sounds like... I need to implement an auxillary property called getDisplayableName/setDisplayableName in order for this to make it into the options construct's. for EVERY class I intend to populate into any select. Just if you don't have a property which already provides what you want. Most of my entity classes have a "name" field and property that could be used already. Of course, whether this is sufficient of enough is very dependent on the specific scenario. And you actually need just the getter. And this is actually pretty standard Java stuff. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: how to use HibernateEntityValueEncoder
So it sounds like... I need to implement an auxillary property called getDisplayableName/setDisplayableName in order for this to make it into the options construct's. for EVERY class I intend to populate into any select. toString is the default displayable for any object i vote for that to be the default instead Thanks for pointing that out for me Thiago. If I can get my webapp to run then i will test it out and maybe implement my own SelectModelFactoryImpl - cheers
RE: how to use HibernateEntityValueEncoder
Thanks Joakim... for trying I tried to get a clean head rev build off my framework providers but its never had a clean head rev build ever (months and years) and I have been very quiet about it limping along waiting for pristine code. They seem to be under the impression that everything just works and tooting their horns on the framework site... when it dont... otherwise I would have been long gone spent busying myself focusing on business logic instead of build problems, codebase corruption code base instrumentation to overcome issues. So I am going to SHcan my attempt at getting a clean fresh build to eliminate these problems and revert back to the buggy code base I have been wrestling with. But if that worked I would have been focusing on business logic still. I will give your suggestion a try. I have been known to be a big mouth or sometimes a bad mouth about open source. At least when I was a committer I maintained a clean and tight head rev build and was always QA'ing the base line functionality to avoid any road blocks or show stoppers for users potentially waiting to go live. Thanks friend - cheers
Re: how to use HibernateEntityValueEncoder
On Tue, 14 May 2013 23:39:46 -0300, Ken in Nashua wrote: tapestry cannot articulate the labelProperty I specified "toString" Of course Tapestry cannot find the toString property. As Joakim said, toString() is not a property. It's a method, but not a property. Properties are defined by get and set methods. That's basic Java knowledge. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: how to use HibernateEntityValueEncoder
What if you add a getDisplayString-method that just do return toString() and change to displayString as property instead. toString does not follow the bean property naming standard get/set/is. /Joakim On Wed, May 15, 2013 at 4:39 AM, Ken in Nashua wrote: > Thanks Thiago... trust me I would send a console trace if I got one. Maybe > my logger isnt tracing those packages in tapestry ? > > The NPE occurs inside (well i sent the browser trace)... > > > org.tynamo.examples.pphl.pages.Query)org.apache.tapestry5.ioc.internal.util.TapestryExceptionjava.lang.NullPointerExceptionFilter > stack frames > Stack trace > > > org.apache.tapestry5.internal.services.SelectModelFactoryImpl.create(SelectModelFactoryImpl.java:55) > > Its happening inside the create call > > tapestry cannot articulate the labelProperty > > I specified "toString" > > I put this in the threads few threads back. > > I appreciate your help > > And no I am not using any dashes or underscores in the primary keye > method... > > Still hoping for a workaround > >
RE: how to use HibernateEntityValueEncoder
Thanks Thiago... trust me I would send a console trace if I got one. Maybe my logger isnt tracing those packages in tapestry ? The NPE occurs inside (well i sent the browser trace)... org.tynamo.examples.pphl.pages.Query)org.apache.tapestry5.ioc.internal.util.TapestryExceptionjava.lang.NullPointerExceptionFilter stack frames Stack trace org.apache.tapestry5.internal.services.SelectModelFactoryImpl.create(SelectModelFactoryImpl.java:55) Its happening inside the create call tapestry cannot articulate the labelProperty I specified "toString" I put this in the threads few threads back. I appreciate your help And no I am not using any dashes or underscores in the primary keye method... Still hoping for a workaround
Re: how to use HibernateEntityValueEncoder
What could really help us in helping you was if you told us in which line the NPE happens. It's really quite hard to help you sometimes. You post a lot of messages and still doesn't provide us the information needed to help you. :( On Tue, 14 May 2013 09:15:16 -0300, Ken in Nashua wrote: Hi Jens, I posted the pojo bean Year.java I really rely on the toString() for most of my entities. I wouldnt think of complicating any of my getters with dashes or underscores let alone complicate a primary keye method. Nobody ever suggested you did that. Someone just mentioned that leading underscores are not handled well by PropertyAdapter so you could check if that was the case. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: how to use HibernateEntityValueEncoder
Hi Jens, I posted the pojo bean Year.java I really rely on the toString() for most of my entities. I wouldnt think of complicating any of my getters with dashes or underscores let alone complicate a primary keye method. This one is fairly obvious. I know I have some environment concerns and need o sync up with greatest/latest tynamo but for the most part my webapp is running. Hoping for a way out of this one today. What if I had a dozen select criteria components on my page ? Well i do... : ( I am trying to model stats just like NHL.com
RE: how to use HibernateEntityValueEncoder
This guy is the culprit... tap-5.3.6 I believe it needs to depend on a default toString() is it fails to find a labelProperty. I need a workaround folks... so waiting on your best. thanks KEN @SuppressWarnings("unchecked") public SelectModel create(final List objects, final String labelProperty) { final List options = CollectionFactory.newList(); for (final Object object : objects) { final ClassPropertyAdapter classPropertyAdapter = this.propertyAccess .getAdapter(object); final PropertyAdapter propertyAdapter = classPropertyAdapter.getPropertyAdapter(labelProperty); final ValueEncoder encoder = this.valueEncoderSource.getValueEncoder(propertyAdapter.getType()); final Object label = propertyAdapter.get(object); options.add(new OptionModelImpl(encoder.toClient(label), object)); } return new SelectModelImpl(null, options); }
RE: how to use HibernateEntityValueEncoder
Ok I am stepping thru the tapestry code during the create call... This is interesting... UnClaimedFieldWorker.JAVA public Object get(Object instance, InstanceContext context) { return fieldValue.get(fieldDefaultValue); } fieldDefaultvalue == null no npe as of yet its starts iterating thru my obejct list looks good so far I am at this line in SelectModelFactoryImpl.JAVA final PropertyAdapter propertyAdapter = classPropertyAdapter.getPropertyAdapter(labelProperty); this is what I see for classPropertyAdapter WHY ISNT THE toString method in this ? it is a legitimate property... yes ? Anyway I specified my labelProperty to be "toString" which should be the default by common sense? propertyAdapter keeps coming back with NULL. What can I do to my Year.JAVA to make this work ? Thanks for your help guys
RE: how to use HibernateEntityValueEncoder
Hi Guys, really sorry about my lapse here in providing the right info and I kow it must be frustrating. I played hockey last night. So i got pre-empted. Ok I am back on the tarp. I will try to get the stack trace for you... but none is being produced in the console... and its an NPE ? I am wondering about that. My Year.Java class... yes its a pojo... I dont understand why that might be a crime... maybe for Date stuff... but its fairly remote and implemented independent. Ok back to he real stuff... Ok I am seeinfg the source code for this has tajken on some changes,,, Here is my blip @Inject @Property private TypeCoercer typeCoercer; @Property private SelectModel yearSelectModel; @Property @Persist(PersistenceConstants.FLASH) private Year year; @Inject private PropertyAccess adapter; @Inject private ValueEncoderSource valueEncoderSource; @SetupRender void setupRender() { SelectModelFactory selectModelFactory = new SelectModelFactoryImpl(adapter, valueEncoderSource); grid.reset(); years = new ArrayList(TynamoUTIL.loadCollection(hibernatePersistenceService, Year.class)); yearSelectModel = selectModelFactory.create(years, "toString"); selectModelFactory is failing because my usage of SelectModelFactoryImpl fails to operate. So I told eclipse to connect to the source code downloaded to my local repo... and sure enough.. in the debugger I see this... final PropertyAdapter propertyAdapter = classPropertyAdapter.getPropertyAdapter(labelProperty); final ValueEncoder encoder = this.valueEncoderSource.getValueEncoder(propertyAdapter.getType()); my propertyAdapter is null and any subsequent attempts to use it fail with NPE But I need to distinguish some kind of label property ? in my year class to this thing ? So it can create the proper OPTIONS eFrastructure ? I figured the Year.toString() method would suffice for this. Here is my Year.JAVA again Not sure what to think... tapestry is failing when I tell it to use Year.toString() What should I do ? @Entity @ClassDescriptor(hasCyclicRelationships = true, nonVisual = false) public class Year implements Cloneable, Serializable { private static final Log log = LogFactory.getLog(Year.class); private Integer id = null; private Integer yearStart = new Integer("0"); private Integer yearEnd = new Integer("0"); private League league = null; private Long created = new Long(GregorianCalendar.getInstance() .getTimeInMillis()); private Long accessed = new Long(GregorianCalendar.getInstance() .getTimeInMillis()); /** * CTOR */ public Year() { } public Year(Year dto) { try { BeanUtils.copyProperties(this, dto); } catch (Exception e) { log.error(e.toString()); e.printStackTrace(); } } /** * Accessor for id * * @return Integer * @hibernate.id generator-class="increment" unsaved-value="-1" * type="java.lang.Integer" unique="true" insert="true" */ @Id @GeneratedValue(strategy = GenerationType.AUTO) @PropertyDescriptor(readOnly = true) public Integer getId() { return id; } @PropertyDescriptor public Integer getYearStart() { return yearStart; } @PropertyDescriptor public Integer getYearEnd() { return yearEnd; } @ManyToOne public League getLeague() { return league; } @PropertyDescriptor(nonVisual = true, searchable = false) public Long getCreated() { return created; } @PropertyDescriptor(nonVisual = true, searchable = false) public Long getAccessed() { return accessed; } @Transient @PropertyDescriptor(nonVisual = true, searchable = false) public String getCreatedAsString() { Calendar cal = new GregorianCalendar(); cal.setTimeInMillis(created.longValue()); return DatePattern.sdf.format(cal.getTime()); } @Transient @PropertyDescriptor(nonVisual = true, searchable = false) public String getAccessedAsString() { Calendar cal = new GregorianCalendar(); cal.setTimeInMillis(accessed.longValue()); return DatePattern.sdf.format(cal.getTime()); } public void setId(Integer id) { this.id = id; } public void setYearStart(Integer yearStart) { this.yearStart = yearStart; } public void setYearEnd(Integer yearEnd) { this.yearEnd = yearEnd; } public void setLeague(League league) { this.league = league; } @Transient @PropertyDescriptor(nonVisual = true, searchable = false) public void setCreatedAsString(String value) throws Exception { Calendar cal = new GregorianCalendar(); cal.setTimeInMillis(DatePattern.sdf.parse(value).getTime());
Re: how to use HibernateEntityValueEncoder
Hi Ken, please paste the whole Bean class, too. I got an NPE in the past due to an leading underscore in my pk member name. "_pk" --> NPE "pk" --> works fine. Guess this is a bug, because Tapestry in general is happy with "_" when accessing properties. Jens Am 13.05.13 23:26, schrieb Ken in Nashua: its obviously happening on the valueencoder final PropertyAdapter propertyAdapter = classPropertyAdapter.getPropertyAdapter(labelProperty);5455final ValueEncoder encoder = this.valueEncoderSource.getValueEncoder(propertyAdapter.getType());56 I changed the property method to toString() and it still fails with NPE - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: how to use HibernateEntityValueEncoder
its obviously happening on the valueencoder final PropertyAdapter propertyAdapter = classPropertyAdapter.getPropertyAdapter(labelProperty);5455final ValueEncoder encoder = this.valueEncoderSource.getValueEncoder(propertyAdapter.getType());56 I changed the property method to toString() and it still fails with NPE
Re: how to use HibernateEntityValueEncoder
On Mon, 13 May 2013 17:15:05 -0300, Ken in Nashua wrote: Hi Thiago, Here is the console... after I induce the NPE. It doesn't contain the stack trace, so it's completely useless. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: how to use HibernateEntityValueEncoder
Thanks Jens... I believe I posted the Year.class for Thiago the primary keye is just ID Is this a bug ? I would like to get into the create routine for the factory but dont know how
RE: how to use HibernateEntityValueEncoder
Ooops... this is the code I am exercising... @Persist @Property private EnumValueEncoder yearValueEncoder; @Inject @Property private TypeCoercer typeCoercer; @Inject private SelectModelFactory selectModelFactory; @Property private SelectModel yearSelectModel; @Property @Persist(PersistenceConstants.FLASH) private Year year; @SetupRender void setupRender() { grid.reset(); years = new ArrayList(TynamoUTIL.loadCollection(hibernatePersistenceService, Year.class)); yearValueEncoder = new EnumValueEncoder(typeCoercer, Year.class); yearSelectModel = selectModelFactory.create(years, "year");
RE: how to use HibernateEntityValueEncoder
Thanks Jens... I just stepped thru debugger... @SetupRender void setupRender() { grid.reset(); years = new ArrayList(TynamoUTIL.loadCollection(hibernatePersistenceService, Year.class)); yearValueEncoder = new EnumValueEncoder(typeCoercer, Year.class); this is what the debugger shows for my years collection after loadCollection gets called. [2012/2013] Thats an entity... Year.class... the toString method So the collection is populating properly. Its stored with standard hibernate Integer id. Kinda blue in the face... kinda
RE: how to use HibernateEntityValueEncoder
Hi Thiago, Here is the console... after I induce the NPE. 2013-05-13 16:11:14.622:INFO:oejs.Server:jetty-7.6.0.v20120127 2013-05-13 16:11:22.970:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one. 2013-05-13 16:11:23.424:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/C:/Prototype/Mavenized/Product/tynamo/trunk/tynamo-examples/pphl/src/main/webapp/},file:/C:/Prototype/Mavenized/Product/tynamo/trunk/tynamo-examples/pphl/src/main/webapp/ 2013-05-13 16:11:29.726:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080 [INFO] Started Jetty Server 127.0.0.1 - - [13/May/2013:20:11:34 +] "GET /pphl/login HTTP/1.1" 200 3301 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/core/default.css HTTP/1.1" 200 2089 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/kawwa2_asset/css/k-structure.css HTTP/1.1" 200 990 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/core/tree.css HTTP/1.1" 200 570 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/core/t5-alerts.css HTTP/1.1" 200 386 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/core/tapestry-console.css HTTP/1.1" 200 322 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/form.css HTTP/1.1" 200 77 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/kawwa2_asset/css/library.css HTTP/1.1" 200 137 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/facebook/components/fb-button.css HTTP/1.1" 200 1395 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/tap-jquery/tapestry.js HTTP/1.1" 200 1739 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/openid-0.2.1-SNAPSHOT-1367865189000/components/button.css HTTP/1.1" 200 1429 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/ui_1_8_24/jquery.ui.widget.js HTTP/1.1" 200 2344 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/ui_1_8_24/jquery.ui.core.js HTTP/1.1" 200 3439 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/ui_1_8_24/jquery.ui.position.js HTTP/1.1" 200 2772 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/jquery.effects.show.js HTTP/1.1" 200 105 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/ui_1_8_24/jquery.effects.highlight.js HTTP/1.1" 200 608 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/jquery.json-2.2.js HTTP/1.1" 200 1930 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0" 127.0.0.1 - - [13/May/2013:20:11:38 +] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/ui_1_8_24/jquery.effects.core.js HTTP/1.1" 200 5436 "http://localhost:8080/pphl/login"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0)
Re: how to use HibernateEntityValueEncoder
Hi Ken! Just a shot in the dark: Are you sure the PKs of your hibernate beans are not null (maybe you have a newly created bean instance which is not persited yet)? Afair the HibernateValueEncoder requires properly filled PK fields otherwise pk.toString() fails. Unfortunately the stacktrace is difficult to read... Jens Sent from my iPhone On 13.05.2013, at 21:00, Ken in Nashua wrote: > thanks guys... but I keep gettign an NPE > >@Persist >@Property >HibernateEntityValueEncoder yearValueEncoder; > >@Inject >private ValueEncoderSource valueEncoderSource; > >@Inject >private SelectModelFactory selectModelFactory; > >private ArrayList years; > >@SetupRender >void setupRender() { >years = new > ArrayList(TynamoUTIL.loadCollection(hibernatePersistenceService, Year.class)); >yearSelectModel = selectModelFactory.create(years, "year"); > } > > my selectModelFactory fails > > Any ideas ? > > An unexpected application exception has > occurred.org.apache.tapestry5.internal.services.RenderQueueExceptionRender > queue error in SetupRender[pphl/Query]: > org.apache.tapestry5.ioc.internal.util.TapestryExceptionactiveComponentspphl/Query > (class > org.tynamo.examples.pphl.pages.Query)org.apache.tapestry5.ioc.internal.util.TapestryExceptionjava.lang.NullPointerExceptionFilter > stack frames > Stack trace > > org.apache.tapestry5.internal.services.SelectModelFactoryImpl.create(SelectModelFactoryImpl.java:55) > > org.tynamo.examples.pphl.pages.Query.setupRender(Query.java:200) > > org.tynamo.examples.pphl.pages.Query.advised$setupRender_844d26137ccc(Query.java) > > org.tynamo.examples.pphl.pages.Query$Invocation_setupRender_844d26137ccb.proceedToAdvisedMethod(Unknown > Source) > > org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:84) > > org.got5.tapestry5.jquery.services.ImportJQueryUIWorker$2.advise(ImportJQueryUIWorker.java:94) > > org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86) > > org.tynamo.examples.pphl.pages.Query.setupRender(Query.java) > > org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.invokeComponent(ComponentPageElementImpl.java:174) > > org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:133) > > org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.render(ComponentPageElementImpl.java:181) > > org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72) > > org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:124) > > org.apache.tapestry5.internal.services.MarkupRendererTerminator.renderMarkup(MarkupRendererTerminator.java:37) > > > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: how to use HibernateEntityValueEncoder
whats so bad about a year class ? @Entity @ClassDescriptor(hasCyclicRelationships = true, nonVisual = false) public class Year implements Cloneable, Serializable { private static final Log log = LogFactory.getLog(Year.class); private Integer id = null; private Integer yearStart = new Integer("0"); private Integer yearEnd = new Integer("0"); private League league = null; private Long created = new Long(GregorianCalendar.getInstance() .getTimeInMillis()); private Long accessed = new Long(GregorianCalendar.getInstance() .getTimeInMillis()); /** * CTOR */ public Year() { } public Year(Year dto) { try { BeanUtils.copyProperties(this, dto); } catch (Exception e) { log.error(e.toString()); e.printStackTrace(); } } /** * Accessor for id * * @return Integer * @hibernate.id generator-class="increment" unsaved-value="-1" * type="java.lang.Integer" unique="true" insert="true" */ @Id @GeneratedValue(strategy = GenerationType.AUTO) @PropertyDescriptor(readOnly = true) public Integer getId() { return id; } @PropertyDescriptor public Integer getYearStart() { return yearStart; } @PropertyDescriptor public Integer getYearEnd() { return yearEnd; } @ManyToOne public League getLeague() { return league; } @PropertyDescriptor(nonVisual = true, searchable = false) public Long getCreated() { return created; } @PropertyDescriptor(nonVisual = true, searchable = false) public Long getAccessed() { return accessed; } @Transient @PropertyDescriptor(nonVisual = true, searchable = false) public String getCreatedAsString() { Calendar cal = new GregorianCalendar(); cal.setTimeInMillis(created.longValue()); return DatePattern.sdf.format(cal.getTime()); } @Transient @PropertyDescriptor(nonVisual = true, searchable = false) public String getAccessedAsString() { Calendar cal = new GregorianCalendar(); cal.setTimeInMillis(accessed.longValue()); return DatePattern.sdf.format(cal.getTime()); } public void setId(Integer id) { this.id = id; } public void setYearStart(Integer yearStart) { this.yearStart = yearStart; } public void setYearEnd(Integer yearEnd) { this.yearEnd = yearEnd; } public void setLeague(League league) { this.league = league; } @Transient @PropertyDescriptor(nonVisual = true, searchable = false) public void setCreatedAsString(String value) throws Exception { Calendar cal = new GregorianCalendar(); cal.setTimeInMillis(DatePattern.sdf.parse(value).getTime()); this.created = new Long(cal.getTimeInMillis()); } @Transient @PropertyDescriptor(nonVisual = true, searchable = false) public void setAccessedAsString(String value) throws Exception { Calendar cal = new GregorianCalendar(); cal.setTimeInMillis(DatePattern.sdf.parse(value).getTime()); this.accessed = new Long(cal.getTimeInMillis()); } public void setAccessed(Long accessed) { this.accessed = accessed; } public void setCreated(Long created) { this.created = created; } @Override public int hashCode() { return (getId() != null ? getId().hashCode() : 0); } @Override public Year clone() { return new Year(this); } /** * equals and hashCode need to be hammered out for hibernate to work * properly * * Check the matrix summary for best practices at * http://www.hibernate.org/109.html */ @Override public boolean equals(Object rhs) { if (this == rhs) return true; // instance equality if (rhs == null || getClass() != rhs.getClass()) return false; // null/class equality final Year castedObject = (Year) rhs; return !(getId() != null ? !getId().equals(castedObject.getId()) : castedObject.getId() != null); } public String toString() { return getYearStart().toString() + "/" + getYearEnd().toString(); } }
Re: how to use HibernateEntityValueEncoder
By the way, do you really have an Year class? Why? On Mon, 13 May 2013 16:00:50 -0300, Ken in Nashua wrote: thanks guys... but I keep gettign an NPE @Persist @Property HibernateEntityValueEncoder yearValueEncoder; @Inject private ValueEncoderSource valueEncoderSource; @Inject private SelectModelFactory selectModelFactory; private ArrayList years; @SetupRender void setupRender() { years = new ArrayList(TynamoUTIL.loadCollection(hibernatePersistenceService, Year.class)); yearSelectModel = selectModelFactory.create(years, "year"); } my selectModelFactory fails Any ideas ? An unexpected application exception has occurred.org.apache.tapestry5.internal.services.RenderQueueExceptionRender queue error in SetupRender[pphl/Query]: org.apache.tapestry5.ioc.internal.util.TapestryExceptionactiveComponentspphl/Query (class org.tynamo.examples.pphl.pages.Query)org.apache.tapestry5.ioc.internal.util.TapestryExceptionjava.lang.NullPointerExceptionFilter stack frames Stack trace org.apache.tapestry5.internal.services.SelectModelFactoryImpl.create(SelectModelFactoryImpl.java:55) org.tynamo.examples.pphl.pages.Query.setupRender(Query.java:200) org.tynamo.examples.pphl.pages.Query.advised$setupRender_844d26137ccc(Query.java) org.tynamo.examples.pphl.pages.Query$Invocation_setupRender_844d26137ccb.proceedToAdvisedMethod(Unknown Source) org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:84) org.got5.tapestry5.jquery.services.ImportJQueryUIWorker$2.advise(ImportJQueryUIWorker.java:94) org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86) org.tynamo.examples.pphl.pages.Query.setupRender(Query.java) org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.invokeComponent(ComponentPageElementImpl.java:174) org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:133) org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.render(ComponentPageElementImpl.java:181) org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72) org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:124) org.apache.tapestry5.internal.services.MarkupRendererTerminator.renderMarkup(MarkupRendererTerminator.java:37) -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: how to use HibernateEntityValueEncoder
Please copy stack traces from the console, not the error page. On Mon, 13 May 2013 16:00:50 -0300, Ken in Nashua wrote: thanks guys... but I keep gettign an NPE @Persist @Property HibernateEntityValueEncoder yearValueEncoder; @Inject private ValueEncoderSource valueEncoderSource; @Inject private SelectModelFactory selectModelFactory; private ArrayList years; @SetupRender void setupRender() { years = new ArrayList(TynamoUTIL.loadCollection(hibernatePersistenceService, Year.class)); yearSelectModel = selectModelFactory.create(years, "year"); } my selectModelFactory fails Any ideas ? An unexpected application exception has occurred.org.apache.tapestry5.internal.services.RenderQueueExceptionRender queue error in SetupRender[pphl/Query]: org.apache.tapestry5.ioc.internal.util.TapestryExceptionactiveComponentspphl/Query (class org.tynamo.examples.pphl.pages.Query)org.apache.tapestry5.ioc.internal.util.TapestryExceptionjava.lang.NullPointerExceptionFilter stack frames Stack trace org.apache.tapestry5.internal.services.SelectModelFactoryImpl.create(SelectModelFactoryImpl.java:55) org.tynamo.examples.pphl.pages.Query.setupRender(Query.java:200) org.tynamo.examples.pphl.pages.Query.advised$setupRender_844d26137ccc(Query.java) org.tynamo.examples.pphl.pages.Query$Invocation_setupRender_844d26137ccb.proceedToAdvisedMethod(Unknown Source) org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:84) org.got5.tapestry5.jquery.services.ImportJQueryUIWorker$2.advise(ImportJQueryUIWorker.java:94) org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86) org.tynamo.examples.pphl.pages.Query.setupRender(Query.java) org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.invokeComponent(ComponentPageElementImpl.java:174) org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:133) org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.render(ComponentPageElementImpl.java:181) org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72) org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:124) org.apache.tapestry5.internal.services.MarkupRendererTerminator.renderMarkup(MarkupRendererTerminator.java:37) -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: how to use HibernateEntityValueEncoder
Here is the tml How do I know which valuencoder its using? Why the NPE ?
RE: how to use HibernateEntityValueEncoder
thanks guys... but I keep gettign an NPE @Persist @Property HibernateEntityValueEncoder yearValueEncoder; @Inject private ValueEncoderSource valueEncoderSource; @Inject private SelectModelFactory selectModelFactory; private ArrayList years; @SetupRender void setupRender() { years = new ArrayList(TynamoUTIL.loadCollection(hibernatePersistenceService, Year.class)); yearSelectModel = selectModelFactory.create(years, "year"); } my selectModelFactory fails Any ideas ? An unexpected application exception has occurred.org.apache.tapestry5.internal.services.RenderQueueExceptionRender queue error in SetupRender[pphl/Query]: org.apache.tapestry5.ioc.internal.util.TapestryExceptionactiveComponentspphl/Query (class org.tynamo.examples.pphl.pages.Query)org.apache.tapestry5.ioc.internal.util.TapestryExceptionjava.lang.NullPointerExceptionFilter stack frames Stack trace org.apache.tapestry5.internal.services.SelectModelFactoryImpl.create(SelectModelFactoryImpl.java:55) org.tynamo.examples.pphl.pages.Query.setupRender(Query.java:200) org.tynamo.examples.pphl.pages.Query.advised$setupRender_844d26137ccc(Query.java) org.tynamo.examples.pphl.pages.Query$Invocation_setupRender_844d26137ccb.proceedToAdvisedMethod(Unknown Source) org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:84) org.got5.tapestry5.jquery.services.ImportJQueryUIWorker$2.advise(ImportJQueryUIWorker.java:94) org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86) org.tynamo.examples.pphl.pages.Query.setupRender(Query.java) org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.invokeComponent(ComponentPageElementImpl.java:174) org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:133) org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.render(ComponentPageElementImpl.java:181) org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72) org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:124) org.apache.tapestry5.internal.services.MarkupRendererTerminator.renderMarkup(MarkupRendererTerminator.java:37)
Re: how to use HibernateEntityValueEncoder
In case you exclusively want to get the encoder, you can inject ComponentDefaultProvider and then use http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/ComponentDefaultProvider.html#defaultValueEncoder(java.lang.String, org.apache.tapestry5.ComponentResources) regards Taha On 13-May-2013, at 4:59 PM, "Thiago H de Paula Figueiredo" wrote: > On Mon, 13 May 2013 04:44:36 -0300, Ken in Nashua wrote: > >> Hi Folks, > > Hi! > >> Finding scant docs on this class usage. >> >> And getting pulled down a rabbit hole. >> >> Are there any example usages of this ? >> >> All i want to do is populate my select component with database entities >> strings. > > HibernateEntityValueEncoder is used automatically. All you need to do is to > have tapestry-hibernate in your classpath. For populating Select's model > parameter, you can use the SelectModelFactory service. > > -- > Thiago H. de Paula Figueiredo > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org >
Re: how to use HibernateEntityValueEncoder
On Mon, 13 May 2013 04:44:36 -0300, Ken in Nashua wrote: Hi Folks, Hi! Finding scant docs on this class usage. And getting pulled down a rabbit hole. Are there any example usages of this ? All i want to do is populate my select component with database entities strings. HibernateEntityValueEncoder is used automatically. All you need to do is to have tapestry-hibernate in your classpath. For populating Select's model parameter, you can use the SelectModelFactory service. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
how to use HibernateEntityValueEncoder
Hi Folks, Finding scant docs on this class usage. And getting pulled down a rabbit hole. Are there any example usages of this ? All i want to do is populate my select component with database entities strings. thanks