[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5250) On setting a String-Value for a integer entity-field in a criterion, produces a ClassCastException, see also HHH-5238

Hannes Havel (JIRA) noreply at atlassian.com
Fri May 21 02:45:13 EDT 2010


On setting a String-Value for a integer entity-field in a criterion, produces a ClassCastException, see also HHH-5238
---------------------------------------------------------------------------------------------------------------------

                 Key: HHH-5250
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5250
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.5.1
            Reporter: Hannes Havel



SEE HHH-5238

Hi Gail,

I am not agree you, that this is not a BUG.

I am not amused that you switch the issue HHH-5238 to resolved, with out any explanation of your view.

Second: your reference, that i should use the forum for help is not on the right place.
because i know, what a question is and what a bug report is.
(I have 20 year of experiance in software development).


================================================
Explanation of my view:

In this case the string consists only numbers and representing a integer number of e.g. "10" and this can be converted to a integer 10 and i am not speaking about to convert a text string to an integer.

JDBC an do this easily.

Is hibernate so restricted ?

How you can establish a generalized query interface where only strings are transported and the provided service has no knowledge about the queried entities and the datatypes of the fields.
So i think a automatic conversion of a string representing a number to the nhumber type and so on is a esential funktionality for a
data sorage and retrieve interface.

For Hibernate the only thing to be changed for the primitive datatype handling is explaind in the following code snipplet:

IntegerType.set(PreparedStatement st, Object value, int index)
	throws SQLException {
		if (value instanceof String)
		 st.setInt( index, Integer.parseInt((String)value));
		else
		 st.setInt( index, ( (Integer) value ).intValue() );		
	}











-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list