how to use HibernateEntityValueEncoder

classic Classic list List threaded Threaded
33 messages Options
12
Reply | Threaded
Open this post in threaded view
|

how to use HibernateEntityValueEncoder

kcolassi
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
     
Best regards and thanks
Ken
Reply | Threaded
Open this post in threaded view
|

Re: how to use HibernateEntityValueEncoder

Thiago H de Paula Figueiredo
On Mon, 13 May 2013 04:44:36 -0300, Ken in Nashua <[hidden email]>  
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: how to use HibernateEntityValueEncoder

Taha Hafeez
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" <[hidden email]> wrote:

> On Mon, 13 May 2013 04:44:36 -0300, Ken in Nashua <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>

Reply | Threaded
Open this post in threaded view
|

RE: how to use HibernateEntityValueEncoder

kcolassi
In reply to this post by kcolassi
thanks guys... but I keep gettign an NPE

    @Persist
    @Property
    HibernateEntityValueEncoder<Year> 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)


     
Best regards and thanks
Ken
Reply | Threaded
Open this post in threaded view
|

RE: how to use HibernateEntityValueEncoder

kcolassi
Here is the tml

                <tr align="left">
                    <td align="center">
                        <select t:type="Select" t:id="yearSelect" t:clientId="yearSelect" id="yearSelect"
                            t:model="prop:yearSelectModel" t:encoder="prop:yearValueEncoder"
                            t:value="prop:year" blankOption="never"
                            />        
                    </td>

How do I know which valuencoder its using?

Why the NPE ?
     
Best regards and thanks
Ken
Reply | Threaded
Open this post in threaded view
|

Re: how to use HibernateEntityValueEncoder

Thiago H de Paula Figueiredo
In reply to this post by kcolassi
Please copy stack traces from the console, not the error page.

On Mon, 13 May 2013 16:00:50 -0300, Ken in Nashua <[hidden email]>  
wrote:

> thanks guys... but I keep gettign an NPE
>
>     @Persist
>     @Property
>     HibernateEntityValueEncoder<Year> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: how to use HibernateEntityValueEncoder

Thiago H de Paula Figueiredo
In reply to this post by kcolassi
By the way, do you really have an Year class? Why?

On Mon, 13 May 2013 16:00:50 -0300, Ken in Nashua <[hidden email]>  
wrote:

> thanks guys... but I keep gettign an NPE
>
>     @Persist
>     @Property
>     HibernateEntityValueEncoder<Year> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: how to use HibernateEntityValueEncoder

kcolassi
In reply to this post by kcolassi
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();
    }
}
     
Best regards and thanks
Ken
Reply | Threaded
Open this post in threaded view
|

Re: how to use HibernateEntityValueEncoder

Jens Breitenstein
In reply to this post by kcolassi
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 <[hidden email]> wrote:

> thanks guys... but I keep gettign an NPE
>
>    @Persist
>    @Property
>    HibernateEntityValueEncoder<Year> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: how to use HibernateEntityValueEncoder

kcolassi
In reply to this post by kcolassi
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 +0000] "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 +0000] "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 +0000] "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 +0000] "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 +0000] "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 +0000] "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 +0000] "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 +0000] "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 +0000] "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 +0000] "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 +0000] "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 +0000] "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 +0000] "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 +0000] "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 +0000] "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 +0000] "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 +0000] "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 +0000] "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) Gecko/20100101 Firefox/19.0"
127.0.0.1 -  -  [13/May/2013:20:11:38 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/core/t5-spi.js HTTP/1.1" 200 1113 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/t5-jquery.js HTTP/1.1" 200 771 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/core/underscore_1_3_3.js HTTP/1.1" 200 10511 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/core/t5-init.js HTTP/1.1" 200 609 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/core/t5-pubsub.js HTTP/1.1" 200 2362 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/core/t5-events.js HTTP/1.1" 200 892 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/core/t5-core.js HTTP/1.1" 200 925 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/t5-dom-jquery.js HTTP/1.1" 200 1805 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/t5-console-jquery.js HTTP/1.1" 200 1108 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/t5-ajax-jquery.js HTTP/1.1" 200 2285 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/kawwa2_asset/theme/css/k-theme0.css HTTP/1.1" 200 17510 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/t5-alerts-jquery.js HTTP/1.1" 200 1265 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/jquery_core/jquery-1.7.2.js HTTP/1.1" 200 73890 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/core/t5-formfragment.js HTTP/1.1" 200 915 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/t5-tree-jquery.js HTTP/1.1" 200 1458 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/core/tapestry-messages.js HTTP/1.1" 200 846 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/core/tapestry-console.js HTTP/1.1" 200 500 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/validation.js HTTP/1.1" 200 2477 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/twitter/components/sign-in-with-twitter-d.png HTTP/1.1" 200 3306 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/federated/base/OauthSignIn.js HTTP/1.1" 200 317 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/openid-0.2.1-SNAPSHOT-1367865189000/components/google-icon.png HTTP/1.1" 200 1996 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/kawwa2_asset/theme/img/k-theme0/bg_required.png HTTP/1.1" 200 1111 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/tapestry-jquery.js HTTP/1.1" 200 9396 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/tapestry-beanvalidator-jquery.js HTTP/1.1" 200 429 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/kawwa2_asset/theme/css/PTS55F-webfont.woff HTTP/1.1" 200 25531 "http://localhost:8080/assets/1.0-SNAPSHOT-1368475842243/kawwa2_asset/theme/css/k-theme0.css" "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/ctx/images/secure1.jpg HTTP/1.1" 200 5121 "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/kawwa2_asset/theme/css/PTS75F-webfont.woff HTTP/1.1" 200 24423 "http://localhost:8080/assets/1.0-SNAPSHOT-1368475842243/kawwa2_asset/theme/css/k-theme0.css" "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/kawwa2_asset/theme/css/Novecentowide-Medium-webfont.woff HTTP/1.1" 200 22019 "http://localhost:8080/assets/1.0-SNAPSHOT-1368475842243/kawwa2_asset/theme/css/k-theme0.css" "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 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/kawwa2_asset/theme/css/Novecentowide-Book-webfont.woff HTTP/1.1" 200 19396 "http://localhost:8080/assets/1.0-SNAPSHOT-1368475842243/kawwa2_asset/theme/css/k-theme0.css" "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:39 +0000] "GET /pphl/query HTTP/1.1" 500 8341 "-" "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:42 +0000] "GET /assets/1.0-SNAPSHOT-1368475842243/jquery/exceptiondisplay-jquery.js HTTP/1.1" 200 588 "http://localhost:8080/pphl/query" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0"

     
Best regards and thanks
Ken
Reply | Threaded
Open this post in threaded view
|

RE: how to use HibernateEntityValueEncoder

kcolassi
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
     
Best regards and thanks
Ken
Reply | Threaded
Open this post in threaded view
|

RE: how to use HibernateEntityValueEncoder

kcolassi
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");
       
     
Best regards and thanks
Ken
Reply | Threaded
Open this post in threaded view
|

RE: how to use HibernateEntityValueEncoder

kcolassi
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
     
Best regards and thanks
Ken
Reply | Threaded
Open this post in threaded view
|

Re: how to use HibernateEntityValueEncoder

Thiago H de Paula Figueiredo
In reply to this post by kcolassi
On Mon, 13 May 2013 17:15:05 -0300, Ken in Nashua <[hidden email]>  
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: how to use HibernateEntityValueEncoder

kcolassi
In reply to this post by kcolassi
its obviously happening on the valueencoder

            final PropertyAdapter propertyAdapter = classPropertyAdapter.getPropertyAdapter(labelProperty);5455            final ValueEncoder encoder = this.valueEncoderSource.getValueEncoder(propertyAdapter.getType());56

I changed the property method to toString() and it still fails with NPE


     
Best regards and thanks
Ken
Reply | Threaded
Open this post in threaded view
|

Re: how to use HibernateEntityValueEncoder

Jens Breitenstein
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);5455            final 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: how to use HibernateEntityValueEncoder

kcolassi
In reply to this post by kcolassi
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());
        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();
    }
}
     
Best regards and thanks
Ken
Reply | Threaded
Open this post in threaded view
|

RE: how to use HibernateEntityValueEncoder

kcolassi
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
<ClassPropertyAdaptor org.tynamo.examples.pphl.model.Year : accessed, accessedAsString, class, created, createdAsString, id, league, yearEnd, yearStart>

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
     
Best regards and thanks
Ken
Reply | Threaded
Open this post in threaded view
|

RE: how to use HibernateEntityValueEncoder

kcolassi
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<OptionModel> 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);
    }
     
Best regards and thanks
Ken
Reply | Threaded
Open this post in threaded view
|

RE: how to use HibernateEntityValueEncoder

kcolassi
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

     
Best regards and thanks
Ken
12