Hibernate version:3.2.0
Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="be.rmi.intranet.db.users" default-lazy="true">
<class name="Function" table="RH_EMP_FUNCTION" lazy="false">
<cache usage="read-write"/>
<id name="id">
<column name="fct_id" not-null="true" unique="true" sql-type="NUMBER"/>
<generator class="sequence">
<param name="sequence">RH_GENERIC_SEQ</param>
</generator>
</id>
<!-- ETC..... -->
</class>
<class name="FunctionGroup" table="RH_EMP_FCT_GROUP" lazy="false">
<cache usage="read-write"/>
<id name="groupId">
<column name="FCT_GROUP_ID" not-null="true" unique="true" sql-type="NUMBER"/>
<generator class="sequence">
<param name="sequence">RH_GENERIC_SEQ</param>
</generator>
</id>
<!-- ETC..... -->
</class>
Hello,
am trying to convert from mapping file to annotations a code that has the following object hierarchy:
most objects inherit from "AbstractId", an abstract class that define the "Id" property and accessors. This is not an entity by itself. Then, in the mapping file, we map the "id" property, for each concrete class, to a corresponding table column, each table having it's own column name, different from other. See example above for 2 classes that inherit from AbstractId.
Question is,
how do i, using EJB3 annotations, map this Id property for each concrete class. I have neither an Id property nor a getId method available in concrete class, considering those methods are in abstract parent class. And i can't put annotation in abstract class considering the annotations must be different for each concrete class (different column mapping) and the abstract class is not an entity.
In the database schema, abstractId does not exist, it just exist for code easiness.