I tried to move my database from MySQL to Oracle. I changed the appropriate config properties (including hibernate.dialect=org.hibernate.dialect.OracleDialect or Oracle9Dialect). But now I get a "BINARY expected got NUMBER" on some queries. I dont really understand where it comes from. I dont have any "BINARY" field in my mappings ...
Where should I be looking for ?
Thanks for the help !
Hibernate version:
3.1.3
Mapping documents:
Meta.hbm.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Attention: Generated code! Do not modify by hand!
Generated by: hibernate.hbm.xml.vsl in andromda-hibernate-cartridge.
-->
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-cascade="none">
<class name="com.project.domain.MetaImpl" table="META" dynamic-insert="false" dynamic-update="false">
<id name="id" type="java.lang.Long" unsaved-value="null">
<column name="ID" sql-type="NUMBER(19)"/>
<generator class="native">
</generator>
</id>
<property name="name" type="java.lang.String">
<column name="NAME" not-null="true" unique="true" sql-type="VARCHAR2(255)"/>
</property>
<property name="description" type="java.lang.String">
<column name="DESCRIPTION" not-null="true" unique="false" sql-type="VARCHAR2(255)"/>
</property>
<property name="keywords" type="java.lang.String">
<column name="KEYWORDS" not-null="true" unique="false" sql-type="VARCHAR2(255)"/>
</property>
<many-to-one name="language" class="com.project.domain.LanguageImpl" cascade="save-update" foreign-key="META_LANGUAGE_FKC" lazy="proxy" fetch="select">
<column name="LANGUAGE_FK" not-null="true" sql-type="NUMBER(19)"/>
</many-to-one>
<set name="sites" table="METAS2SITES" order-by="SITES_FK" lazy="true" fetch="select" inverse="false" cascade="save-update">
<key foreign-key="SITE_METAS_FKC">
<column name="METAS_FK" sql-type="NUMBER(19)"/>
</key>
<many-to-many class="com.project.domain.SiteImpl" foreign-key="META_SITES_FKC">
<column name="SITES_FK" sql-type="NUMBER(19)"/>
</many-to-many>
</set>
</class>
</hibernate-mapping>
Site.hbm.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Attention: Generated code! Do not modify by hand!
Generated by: hibernate.hbm.xml.vsl in andromda-hibernate-cartridge.
-->
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-cascade="none">
<class name="com.project.domain.SiteImpl" table="SITE" dynamic-insert="false" dynamic-update="false">
<id name="id" type="java.lang.Long" unsaved-value="null">
<column name="ID" sql-type="NUMBER(19)"/>
<generator class="native">
</generator>
</id>
<property name="name" type="java.lang.String">
<column name="NAME" not-null="true" unique="true" sql-type="VARCHAR2(255)"/>
</property>
<property name="visible" type="java.lang.Boolean">
<column name="VISIBLE" not-null="true" unique="false" sql-type="NUMBER(1)"/>
</property>
<property name="versionNumber" type="java.lang.String">
<column name="VERSION_NUMBER" not-null="false" unique="false" sql-type="VARCHAR2(255)"/>
</property>
<property name="exportDate" type="java.util.Date">
<column name="EXPORT_DATE" not-null="false" unique="false" sql-type="TIMESTAMP(3)"/>
</property>
<property name="exportSummary" type="java.lang.String">
<column name="EXPORT_SUMMARY" not-null="false" unique="false" sql-type="VARCHAR2(255)"/>
</property>
</class>
</hibernate-mapping>
Language.hbm.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Attention: Generated code! Do not modify by hand!
Generated by: hibernate.hbm.xml.vsl in andromda-hibernate-cartridge.
-->
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-cascade="none">
<class name="com.project.domain.LanguageImpl" table="LANGUAGE" dynamic-insert="false" dynamic-update="false">
<id name="id" type="java.lang.Long" unsaved-value="null">
<column name="ID" sql-type="NUMBER(19)"/>
<generator class="native">
</generator>
</id>
<property name="name" type="java.lang.String">
<column name="NAME" not-null="true" unique="true" sql-type="VARCHAR2(255)"/>
</property>
<property name="code" type="java.lang.String">
<column name="CODE" not-null="true" unique="true" sql-type="VARCHAR2(255)"/>
</property>
<property name="visible" type="java.lang.Boolean">
<column name="VISIBLE" not-null="true" unique="false" sql-type="NUMBER(1)"/>
</property>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
org.hibernate.Query queryObject = super.getSession(false).createQuery("from com.project.domain.Meta as meta where ((:languageId is null) or (meta.language = :languageId)) and ((:siteId is null) or (:siteId in elements(meta.sites)))");
queryObject.setParameter("languageId", languageId);
queryObject.setParameter("siteId", siteId);
java.util.List results = queryObject.list();
transformEntities(transform, results);
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html