[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3017) Query with an IN Clause object that holds an Enum is failing with ORA-01722: invalid number (Criteria) OR ORA-17041: Missing IN or OUT parameter at index (HQL)

Adam Wozniak (JIRA) noreply at atlassian.com
Wed Aug 26 12:32:15 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33852#action_33852 ] 

Adam Wozniak commented on HHH-3017:
-----------------------------------

I had the same ORA error (ORA-01722: invalid number) but (after investigation) I found an error in my code. I forgot about Enumerated annotation for getter with particular enum column.

Now my getter looks like this:
	@Column(name="CH_STATUS", nullable=false)
	@Enumerated(EnumType.STRING)
	public ChStatusEnum getChStatus()
	{
		return chStatus;
	}

Take care,
Adam Wozniak

> Query with an IN Clause object that holds an Enum is failing with ORA-01722: invalid number (Criteria) OR ORA-17041: Missing IN or OUT parameter at index (HQL)
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-3017
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3017
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: query-criteria
>    Affects Versions: 3.2.0.ga
>         Environment: Hibernate 3.2.0  (cr4)
> Oracle
> Annotations
>            Reporter: Li Ho
>
> I am trying to do a query with an IN clause.  The object I am passing into the IN clause contains an Enum.  I'm not 100% sure, but I think the Enum is causing the problem based on the resulting error message.
> When I use the Criteria API, I get the following error: 
> ORA-01722: invalid number 
> When I use the equivalent HQL, I get:
> ORA-17041: Missing IN or OUT parameter at index
> Here is some code (using criteria) that produces the error
>         List<AccountKey> accountKeys;  // AccountKey contains some Strings and an Enum
>        ...
>         List results = session.createCriteria(MyObject.class).
>             add(Expression.in("key.account.key", accountKeys)). 
>             list();
> The debug SQL looks right... and when I manually try it by replacing the ? params with valid values, it works!  So, it seems like there's a problem with the passing of the query parameter values.
> I am currently working around this issue by bypassing the object comparison.  I extract the variables I want to compare and force it to do a direct String comparison on those elements.

-- 
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