- This topic has 2 replies, 2 voices, and was last updated 18 years ago by paul_ronan.
-
AuthorPosts
-
paul_ronanMemberHi,
I’m fairly new to Hibernate and to myeclipse which I’m sure has resulted in the following problem. The exception is thrown from a select all:
List ccyGroups = session.createQuery(“from Ccygroup”).list();its a querysyntaxexception with the detail being ‘Ccygroup not mapped’
the table looks like so:-
create table “CCYGROUP”(
“GROUPID” INTEGER not null,
“NAME” VARCHAR(30) not null,
“PRODUCT” VARCHAR(50) not null,
constraint “SYS_PK_113” primary key (“GROUPID”)
);create unique index “SYS_PK_113” on “CCYGROUP”(“GROUPID”);
and the hibernate file generated from reverse engineering looks like this:
<hibernate-mapping>
<class name=”com.p3fx.reference.CcyGroup” table=”CCYGROUP” schema=”PUBLIC”>
<id name=”groupid” type=”java.lang.Integer”>
<column name=”GROUPID” />
<generator class=”assigned”></generator>
</id>
<property name=”name” type=”java.lang.String”>
<column name=”NAME” length=”30″ not-null=”true” />
</property>
<property name=”product” type=”java.lang.String”>
<column name=”PRODUCT” length=”50″ not-null=”true” />
</property>
<set name=”ccygroupCurrencies” inverse=”true”>
<key>
<column name=”GROUPID” not-null=”true” />
</key>
<one-to-many class=”com.p3fx.reference.CcyGroupCurrency” />
</set>
</class>
</hibernate-mapping>
the set refers to a join table which looks like
create table “CCYGROUP_CURRENCY”(
“GROUPID” INTEGER not null,
“CURRENCY” VARCHAR(3) not null
);alter table “CCYGROUP_CURRENCY”
add constraint “GROUPID”
foreign key (“GROUPID”)
references “CCYGROUP”(“GROUPID”);
alter table “CCYGROUP_CURRENCY”
add constraint “CODE”
foreign key (“CURRENCY”)
references “CURRENCY”(“CODE”);
create index “SYS_IDX_103” on “CCYGROUP_CURRENCY”(“CURRENCY”);
create index “SYS_IDX_114” on “CCYGROUP_CURRENCY”(“GROUPID”);which links ccygroup with the currency table:
create table “CURRENCY”(
“CODE” VARCHAR(3) not null,
“NUMERIC” INTEGER not null,
“NAME” VARCHAR(150) not null,
constraint “SYS_PK_59” primary key (“CODE”)
);create unique index “SYS_PK_59” on “CURRENCY”(“CODE”);
any help would be appreciated
Haris PecoMemberPaul,
You have CcyGroup in mapping and Ccygroup in HQL – Hibernate is case sensitive
Regards,
paul_ronanMemberthanks for the help!
-
AuthorPosts