Kevin Tunstall created OFBIZ-5214:
-------------------------------------

             Summary: Different column sorting in entitymodel.xml and database 
causes PSQLException
                 Key: OFBIZ-5214
                 URL: https://issues.apache.org/jira/browse/OFBIZ-5214
             Project: OFBiz
          Issue Type: Bug
          Components: framework
    Affects Versions: SVN trunk
            Reporter: Kevin Tunstall


Due to r1486552, different column sorting in entitymodel.xml and database now 
causes a PSQLException, when an entity is selected without any selectFields. 
The index of the column in entitymodel.xml may not correspond to the index of 
the column in the database. Before r1486552, a select with all fields names 
instead of a "select *" was used.

Example stacktrace:
{quote}
2013-06-07 14:20:32,937 (main) [      EntityListIterator:346:WARN ] [ ] [] 
Warning: auto-closed EntityListIterator because of exception: 
org.ofbiz.entity.GenericDataSourceException: SQL Exception while getting value 
: oldAmountPerQuantity [AMOUNT_PER_QUANTITY] (33) (Bad value for type 
BigDecimal : 2013-06-07 14:20:32.306+02)
2013-06-07 14:20:32,941 (main) [        GenericDelegator:1812:ERROR] [ ] [] 
---- exception report ----------------------------------------------------------
Failure in findByCondition operation for entity [OrderAdjustment]: 
org.ofbiz.entity.GenericEntityException: Error creating GenericValue (SQL 
Exception while getting value : oldAmountPerQuantity [AMOUNT_PER_QUANTITY] (33) 
(Bad value for type BigDecimal : 2013-06-07 14:20:32.306+02)). Rolling back 
transaction.
Exception: org.ofbiz.entity.GenericEntityException
Message: Error creating GenericValue (SQL Exception while getting value : 
oldAmountPerQuantity [AMOUNT_PER_QUANTITY] (33) (Bad value for type BigDecimal 
: 2013-06-07 14:20:32.306+02))
---- cause ---------------------------------------------------------------------
Exception: org.ofbiz.entity.GenericDataSourceException
Message: SQL Exception while getting value : oldAmountPerQuantity 
[AMOUNT_PER_QUANTITY] (33) (Bad value for type BigDecimal : 2013-06-07 
14:20:32.306+02)
---- cause ---------------------------------------------------------------------
Exception: org.postgresql.util.PSQLException
Message: Bad value for type BigDecimal : 2013-06-07 14:20:32.306+02
---- stack trace ---------------------------------------------------------------
org.postgresql.util.PSQLException: Bad value for type BigDecimal : 2013-06-07 
14:20:32.306+02
org.postgresql.jdbc2.AbstractJdbc2ResultSet.toBigDecimal(AbstractJdbc2ResultSet.java:2816)
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBigDecimal(AbstractJdbc2ResultSet.java:2237)
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBigDecimal(AbstractJdbc2ResultSet.java:323)
org.apache.commons.dbcp.DelegatingResultSet.getBigDecimal(DelegatingResultSet.java:340)
org.apache.commons.dbcp.DelegatingResultSet.getBigDecimal(DelegatingResultSet.java:340)
org.ofbiz.entity.jdbc.SqlJdbcUtil.getValue(SqlJdbcUtil.java:692)
org.ofbiz.entity.util.EntityListIterator.currentGenericValue(EntityListIterator.java:178)
org.ofbiz.entity.util.EntityListIterator.next(EntityListIterator.java:325)
org.ofbiz.entity.util.EntityListIterator.getCompleteList(EntityListIterator.java:439)
org.ofbiz.entity.GenericDelegator.findList(GenericDelegator.java:1802)
org.ofbiz.entity.GenericDelegator.findByAnd(GenericDelegator.java:1735)
org.ofbiz.entity.Delegator$findByAnd.call(Unknown Source)
{quote}
Here, the column actually read from the database was a date, but the column 
used  in the JdbcValueHandler is a BigDecimal.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to