You may be able to workaround this issue by using Postgresql encode function to cast the first usage of :name from bytea to varchar. I'm not familiar enough with this function to know for sure. I see that when HQL/JPQL is used, Hibernate recognizes that :name should be treated as a StringType for both instances where that parameter is used. When a native query is used though, Hibernate determines that the first time :name is used, it should be treated as a SerializableType, and the second time :name should be treated as StringType. An improvement would be for Hibernate to determine that both usages of the same parameter should be treated as the same type, in this case StringType. |