Issue with rendering FindScreenDecorator in the latest revision

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

Issue with rendering FindScreenDecorator in the latest revision

arini.rusda
Hi, I am new to ofbiz and i am using two version, the latest revision: 1076135 and also the stable version 10.4 . I try to make simple component like in the example component, and i am using entities i've created.

The problem is my form works okay in the stable version when i try to retrieve data from the entity, even there's a warning of GenericEntity.set because i am using integer type for the id instead of string (CMIIW):
=-=-=-=-=-=-=-=-= Database type warning GenericEntity.set =-=-=-=-=-=-=-=-= In entity field [KnbsType.knbsTypeId] set the value passed in [java.lang.String] is not compatible with the Java type of the field [Long]
Exception: java.lang.Exception
Message: Location of database type warning
---- stack trace ---------------------------------------------------------------
java.lang.Exception: Location of database type warning
org.ofbiz.entity.GenericEntity.set(GenericEntity.java:426)
org.ofbiz.entity.GenericEntity.setFields(GenericEntity.java:945)
..
but when i tried copy my component to the latest revision hot-deploy, i got this error in the screen on the column of Type like this:
the error
 
and beside that GenericEntity.set warning, there's error stack trace on the console log  :
2011-03-02 15:31:33,450 (http-0.0.0.0-8443-1) [        ModelScreen.java:429:ERROR]
---- exception report ----------------------------------------------------------
Could not commit transaction: org.ofbiz.entity.transaction.GenericTransactionException: Roll back error, could not commit transaction, was rolled back instead because of: Error rendering screen [component://common/widget/CommonScreens.xml#FindScreenDecorator]: java.lang.ClassCastExceptionjava.lang.ClassCastException (null)
Exception: org.ofbiz.entity.transaction.GenericTransactionException
Message: Roll back error, could not commit transaction, was rolled back instead because of: Error rendering screen [component://common/widget/CommonScreens.xml#FindScreenDecorator]: java.lang.ClassCastExceptionjava.lang.ClassCastException (null)
---- cause ---------------------------------------------------------------------
Exception: java.lang.ClassCastException
Message: null
---- stack trace ---------------------------------------------------------------
java.lang.ClassCastException
java.lang.Class.cast(Unknown Source)
org.ofbiz.entity.jdbc.SqlJdbcUtil.setValue(SqlJdbcUtil.java:756)
org.ofbiz.entity.jdbc.SqlJdbcUtil.setValue(SqlJdbcUtil.java:735)
org.ofbiz.entity.jdbc.SqlJdbcUtil.setPkValues(SqlJdbcUtil.java:489)
org.ofbiz.entity.datasource.GenericDAO.select(GenericDAO.java:523)
org.ofbiz.entity.datasource.GenericDAO.select(GenericDAO.java:493)
...
i don't know why this is happen, because my form works fine in the stable version (even there's a warning like i've mentioned before), this is the code of the form :
form code

is this a bug? any ideas? Thank you in advance.
Best Regards,
Arini Rusda
Informatics Department, Sepuluh Nopember Institute of Technology
Reply | Threaded
Open this post in threaded view
|

Re: Issue with rendering FindScreenDecorator in the latest revision

Adrian Crum-3
The database is expecting a long data type and you are trying to store a
String. Convert the String to a long before you store it.

-Adrian

On 3/2/2011 1:59 AM, arini.rusda wrote:

> Hi, I am new to ofbiz and i am using two version, the latest revision:
> 1076135 and also the stable version 10.4 . I try to make simple component
> like in the example component, and i am using entities i've created.
>
> The problem is my form works okay in the stable version when i try to
> retrieve data from the entity, even there's a warning of GenericEntity.set
> because i am using integer type for the id instead of string (CMIIW):
>
>
>> =-=-=-=-=-=-=-=-= Database type warning GenericEntity.set
>> =-=-=-=-=-=-=-=-= In entity field [KnbsType.knbsTypeId] set the value
>> passed in [java.lang.String] is not compatible with the Java type of the
>> field [Long]
>> Exception: java.lang.Exception
>> Message: Location of database type warning
>> ---- stack trace
>> ---------------------------------------------------------------
>> java.lang.Exception: Location of database type warning
>> org.ofbiz.entity.GenericEntity.set(GenericEntity.java:426)
>> org.ofbiz.entity.GenericEntity.setFields(GenericEntity.java:945)
>> ..
>>
> but when i tried copy my component to the latest revision hot-deploy, i got
> this error in the screen on the column of Type like this:
> http://ofbiz.135035.n4.nabble.com/file/n3331268/Untitled.png
>
> and beside that GenericEntity.set warning, there's error stack trace on the
> console log  :
>
>
>> 2011-03-02 15:31:33,450 (http-0.0.0.0-8443-1) [
>> ModelScreen.java:429:ERROR]
>> ---- exception report
>> ----------------------------------------------------------
>> Could not commit transaction:
>> org.ofbiz.entity.transaction.GenericTransactionException: Roll back error,
>> could not commit transaction, was rolled back instead because of: Error
>> rendering screen
>> [component://common/widget/CommonScreens.xml#FindScreenDecorator]:
>> java.lang.ClassCastExceptionjava.lang.ClassCastException (null)
>> Exception: org.ofbiz.entity.transaction.GenericTransactionException
>> Message: Roll back error, could not commit transaction, was rolled back
>> instead because of: Error rendering screen
>> [component://common/widget/CommonScreens.xml#FindScreenDecorator]:
>> java.lang.ClassCastExceptionjava.lang.ClassCastException (null)
>> ---- cause
>> ---------------------------------------------------------------------
>> Exception: java.lang.ClassCastException
>> Message: null
>> ---- stack trace
>> ---------------------------------------------------------------
>> java.lang.ClassCastException
>> java.lang.Class.cast(Unknown Source)
>> org.ofbiz.entity.jdbc.SqlJdbcUtil.setValue(SqlJdbcUtil.java:756)
>> org.ofbiz.entity.jdbc.SqlJdbcUtil.setValue(SqlJdbcUtil.java:735)
>> org.ofbiz.entity.jdbc.SqlJdbcUtil.setPkValues(SqlJdbcUtil.java:489)
>> org.ofbiz.entity.datasource.GenericDAO.select(GenericDAO.java:523)
>> org.ofbiz.entity.datasource.GenericDAO.select(GenericDAO.java:493)
>> ...
>>
> i don't know why this is happen, because my form works fine in the stable
> version (even there's a warning like i've mentioned before), this is the
> code of the form :
> http://ofbiz.135035.n4.nabble.com/file/n3331268/Untitled3.png
>
> is this a bug? any ideas? Thank you in advance.
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Issue-with-rendering-FindScreenDecorator-in-the-latest-revision-tp3331268p3331268.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Issue with rendering FindScreenDecorator in the latest revision

arini.rusda
hi, thanks for the reply.

but i don't think i store any data, i just retrieve the data from the database..
and it works in the 10.4 stable version even there's that warning.
 
btw, are ofbiz requires all the id's type to be in string (it seems that all the id in ofbiz data model was in string)? because i'm using the exact way like in the example component and it works in the example component and the difference between the example's entityset with mine is i'm using long type for id's, .


Adrian Crum-3 wrote
The database is expecting a long data type and you are trying to store a
String. Convert the String to a long before you store it.

-Adrian
Best Regards,
Arini Rusda
Informatics Department, Sepuluh Nopember Institute of Technology
Reply | Threaded
Open this post in threaded view
|

Re: Issue with rendering FindScreenDecorator in the latest revision

Adrian Crum-3
You can look at the entity definition and the fieldtype*.xml file for
your database to find out what Java type and SQL type is used for each
field.

-Adrian


On 3/2/2011 4:56 AM, arini.rusda wrote:

> hi, thanks for the reply.
>
> but i don't think i store any data, i just retrieve the data from the
> database..
> and it works in the 10.4 stable version even there's that warning.
>
> btw, are ofbiz requires all the id's type to be in string (it seems that all
> the id in ofbiz data model was in string)? because i'm using the exact way
> like in the example component and it works in the example component and the
> difference between the example's entityset with mine is i'm using long type
> for id's, .
>
>
>
> Adrian Crum-3 wrote:
>> The database is expecting a long data type and you are trying to store a
>> String. Convert the String to a long before you store it.
>>
>> -Adrian
>>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Issue-with-rendering-FindScreenDecorator-in-the-latest-revision-tp3331268p3331442.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Issue with rendering FindScreenDecorator in the latest revision

Jacques Le Roux
Administrator
In reply to this post by arini.rusda
Yes, in OFBiz all Ids are of id or id-ne type. You may refer to user ML archive, for instance
http://markmail.org/message/6lgkg2y4avab6u7d

Why would you need rather long? BTW see how it's translated in your DB: the type long does not exist in data model, it's numeric

HTH

Jacques

From: "arini.rusda" <[hidden email]>

> hi, thanks for the reply.
>
> but i don't think i store any data, i just retrieve the data from the
> database..
> and it works in the 10.4 stable version even there's that warning.
>
> btw, are ofbiz requires all the id's type to be in string (it seems that all
> the id in ofbiz data model was in string)? because i'm using the exact way
> like in the example component and it works in the example component and the
> difference between the example's entityset with mine is i'm using long type
> for id's, .
>
>
>
> Adrian Crum-3 wrote:
>>
>> The database is expecting a long data type and you are trying to store a
>> String. Convert the String to a long before you store it.
>>
>> -Adrian
>>
>
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/Issue-with-rendering-FindScreenDecorator-in-the-latest-revision-tp3331268p3331442.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: Issue with rendering FindScreenDecorator in the latest revision

arini.rusda
Hi, thanks for reply,

i was using the numeric type actually (i mean the `long` type is in the database), i'm sorry for the misunderstanding. i was using the numeric type just for trial so i think i could do auto-increment easier (i'm not really sure about it, though). Do you know why is ofbiz use string for all of the id? is that a kind of best practice?

Well, anyway, i've just tried to use the type= id and it works perfectly right now :),
but still i'm curious how if i really want my id's in numeric type? what should i do so that ofbiz could convert it right?

-Arini
 
Best Regards,
Arini Rusda
Informatics Department, Sepuluh Nopember Institute of Technology
Reply | Threaded
Open this post in threaded view
|

Re: Issue with rendering FindScreenDecorator in the latest revision

Paul Foxworthy
Hi Arini,

Ofbiz doesn't rely on sequence numbers from databases. It can manage sequence numbers itself - see the SequenceUtil class.

Cheers

Paul Foxworthy

arini.rusda wrote
Hi, thanks for reply,

i was using the numeric type actually (i mean the `long` type is in the database), i'm sorry for the misunderstanding. i was using the numeric type just for trial so i think i could do auto-increment easier (i'm not really sure about it, though). Do you know why is ofbiz use string for all of the id? is that a kind of best practice?

Well, anyway, i've just tried to use the type= id and it works perfectly right now :),
but still i'm curious how if i really want my id's in numeric type? what should i do so that ofbiz could convert it right?

-Arini
--
Coherent Software Australia Pty Ltd
http://www.coherentsoftware.com.au/

Bonsai ERP, the all-inclusive ERP system
http://www.bonsaierp.com.au/
Reply | Threaded
Open this post in threaded view
|

Re: Issue with rendering FindScreenDecorator in the latest revision

arini.rusda
Thanks, Paul
I've noticed the SequenceUtil class in OFBiz.

How about the ClassCastException when i'm using numeric type instead of string for a primary key of some table in the database, do you have any ideas?

Best Regards,
Arini Rusda
Informatics Department, Sepuluh Nopember Institute of Technology
Reply | Threaded
Open this post in threaded view
|

Re: Issue with rendering FindScreenDecorator in the latest revision

Paul Foxworthy
Hi Arini,

Are you talking about this message you described earlier?

In entity field [KnbsType.knbsTypeId] set the value passed in [java.lang.String] is not compatible with the Java type of the field [Long]

I think you have the knbsTypeId field in the entity defined as numeric, but in the parameter to the service that displays the data, you've got it as string.

Cheers

Paul Foxworthy

arini.rusda wrote
Thanks, Paul
I've noticed the SequenceUtil class in OFBiz.

How about the ClassCastException when i'm using numeric type instead of string for a primary key of some table in the database, do you have any ideas?
--
Coherent Software Australia Pty Ltd
http://www.coherentsoftware.com.au/

Bonsai ERP, the all-inclusive ERP system
http://www.bonsaierp.com.au/
Reply | Threaded
Open this post in threaded view
|

Re: Issue with rendering FindScreenDecorator in the latest revision

Paul Foxworthy
In reply to this post by arini.rusda
Hi Arini,

For more on why primary keys are of character type, see

https://cwiki.apache.org/OFBIZ/faq-tips-tricks-cookbook-howto.html#FAQ-Tips-Tricks-Cookbook-HowTo-WhyprimarykeysareVARCHARtypeinOFBiz


Cheers

Paul Foxworthy

arini.rusda wrote
Hi, thanks for reply,

i was using the numeric type actually (i mean the `long` type is in the database), i'm sorry for the misunderstanding. i was using the numeric type just for trial so i think i could do auto-increment easier (i'm not really sure about it, though). Do you know why is ofbiz use string for all of the id? is that a kind of best practice?

Well, anyway, i've just tried to use the type= id and it works perfectly right now :),
but still i'm curious how if i really want my id's in numeric type? what should i do so that ofbiz could convert it right?

-Arini
--
Coherent Software Australia Pty Ltd
http://www.coherentsoftware.com.au/

Bonsai ERP, the all-inclusive ERP system
http://www.bonsaierp.com.au/
Reply | Threaded
Open this post in threaded view
|

Re: Issue with rendering FindScreenDecorator in the latest revision

Jacques Le Roux
Administrator
Thanks Paul,

Even forgot I wrote that :)

Jacques

From: "Paul Foxworthy" <[hidden email]>

> Hi Arini,
>
> For more on why primary keys are of character type, see
>
> https://cwiki.apache.org/OFBIZ/faq-tips-tricks-cookbook-howto.html#FAQ-Tips-Tricks-Cookbook-HowTo-WhyprimarykeysareVARCHARtypeinOFBiz
> https://cwiki.apache.org/OFBIZ/faq-tips-tricks-cookbook-howto.html#FAQ-Tips-Tricks-Cookbook-HowTo-WhyprimarykeysareVARCHARtypeinOFBiz
>
>
> Cheers
>
> Paul Foxworthy
>
>
> arini.rusda wrote:
>>
>> Hi, thanks for reply,
>>
>> i was using the numeric type actually (i mean the `long` type is in the
>> database), i'm sorry for the misunderstanding. i was using the numeric
>> type just for trial so i think i could do auto-increment easier (i'm not
>> really sure about it, though). Do you know why is ofbiz use string for all
>> of the id? is that a kind of best practice?
>>
>> Well, anyway, i've just tried to use the type= id and it works perfectly
>> right now :),
>> but still i'm curious how if i really want my id's in numeric type? what
>> should i do so that ofbiz could convert it right?
>>
>> -Arini
>>
>
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/Issue-with-rendering-FindScreenDecorator-in-the-latest-revision-tp3331268p3404588.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Issue with rendering FindScreenDecorator in the latest revision

arini.rusda
In reply to this post by Paul Foxworthy
Hi Paul,

Thank you for the link Paul :), I haven't noticed it before. Now i see why it is varchar, thanks!
Best Regards,
Arini Rusda
Informatics Department, Sepuluh Nopember Institute of Technology