Re: Re:override toString()

[email protected] Mon, 14 Jun 2010 19:32:17 +1000
Newsgroups gmane.comp.java.orm.simpleorm
Message-ID <[email protected]>
Hello Guenter,

I don't quite follow, but it is odd that you would define toString.  All the SimpleOrm objects have toStrings, but for the purpose of debug/trace.  See SRecordInstance.toString and toStringDefault.

If you want to get a key string, say, create a new method getKeyString().

Regards,

Anthony

At 02:05 AM 12/06/2010, dreysfy wrote:
>  
>
>Hi,
>
>the StackOverflowError hints at the getString() uses toString() method again ... and here you go -> stack overflow.
>
>Greets
>
>--- In <mailto:SimpleORM%40yahoogroups.com>[email protected], Guenter Wildmann <a8909020@...> wrote:
>>
>> Sorry for the late response, i have been away for a while.
>> 
>> If i have a table 'Template' with a primary key 'ID', the toString()
>> looks like
>> 
>> public String toString() {
>> return getString(ID);
>> }
>> 
>> and i do a
>> 
>> ses.findOrCreate(Template.TEMPLATE, "Template 1")
>> 
>> i get
>> 
>> -findOrCreate [SRecM Template] {Template 1}
>> Exception in thread "main" java.lang.StackOverflowError
>> at
>> simpleorm.dataset.SRecordInstance.isNotDestroyed(SRecordInstance.java:830)
>> at
>> simpleorm.dataset.SRecordInstance.checkFieldIsAccessible(SRecordInstance.java:310)
>> at simpleorm.dataset.SRecordInstance.getObject(SRecordInstance.java:305)
>> at simpleorm.dataset.SRecordInstance.getString(SRecordInstance.java:485)
>> at at.it_lab.uc4.installtool.db.Template.toString(Template.java:53)
>> at java.lang.String.valueOf(String.java:2827)
>> at java.lang.StringBuilder.append(StringBuilder.java:115)
>> at simpleorm.dataset.SFieldScalar.getRawFieldValue(SFieldScalar.java:126)
>> at simpleorm.dataset.SRecordInstance.getObject(SRecordInstance.java:306)
>> at simpleorm.dataset.SRecordInstance.getString(SRecordInstance.java:485)
>> at at.it_lab.uc4.installtool.db.Template.toString(Template.java:53)
>> at java.lang.String.valueOf(String.java:2827)
>> at java.lang.StringBuilder.append(StringBuilder.java:115)
>> ......
>> 
>> 
>> Any ideas?
>> 
>> Ciao, Guenter
>>
>
>

Dr Anthony Berglas, [email protected]       Mobile: +61 4 4838 8874
Just because it is possible to push twigs along the ground with ones nose
does not necessarily mean that is the best way to collect firewood.



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/SimpleORM/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/SimpleORM/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/