facebook

hibernate ‘not mapped’ exception at runtime

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #264266 Reply

    paul_ronan
    Member

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

    #264314 Reply

    Haris Peco
    Member

    Paul,

    You have CcyGroup in mapping and Ccygroup in HQL – Hibernate is case sensitive

    Regards,

    #264394 Reply

    paul_ronan
    Member

    thanks for the help!

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: hibernate ‘not mapped’ exception at runtime

You must be logged in to post in the forum log in