Trying to do a many-to-many (w/ join table) on a field in a table that is not the primary key (but is unique). I "think" hibernate is trying to map the GUID (40 length character) to the NUMBER(10) id in the STATIC_HTMLS table. But I am not sure. Any ideas? Anyone?
I am getting the following error
Code:
org.hibernate.exception.SQLGrammarException: could not initialize a collection
SQL Error: 1722, SQLState: 42000
ORA-01722: invalid number
The ORA number means that oracle tried to perform a numeric operation on a non-numeric field.
Mapping:
Code:
<class name="StaticHtml" table="STATIC_HTMLS">
<id name="id" column="STATIC_HTML_ID">
<generator class="native"/>
</id>
<property name="guid" column="GUID" unique="true" />
<set name="permissionSet" table="PERMISSION_X_GUID">
<key column="GUID"/>
<many-to-many class="Permission" column="PERMISSION_ID" unique="true"/>
</set>
</class>
<class name="Permission" table="PERMISSIONS">
<id name="id" column="PERMISSION_ID">
<generator class="native"/>
</id>
<property name="plevel" column="PLEVEL" />
</class>
SQL DDL
Code:
CREATE TABLE PERMISSIONS
(
PERMISSION_ID NUMBER(10) NOT NULL,
PLEVEL NUMBER(10) NOT NULL,
PRIMARY KEY(PERMISSION_ID)
);
CREATE TABLE PERMISSION_X_GUID
(
PERMISSION_ID NUMBER(10) NOT NULL,
GUID CHAR(40) NOT NULL,
PRIMARY KEY(PERMISSION_ID,GUID)
);
CREATE TABLE STATIC_HTMLS
(
STATIC_HTML_ID NUMBER(10) NOT NULL,
GUID CHAR(40) NOT NULL,
PRIMARY KEY(STATIC_HTML_ID)
);