Hi all,
i have written a hibernate mapping which builds an object from SQL resultset. it is actually read only. i dont need an extra DB-table to store this mapped entity.
it works fine till now.
now i need use hibernate.hbm2ddl.auto=update in my application.
this tool create all the missing tables including my readonly-entity table.
how can I tell hbm to omit such mappings for schema exporting?
Code:
<hibernate-mapping>
<class name="MyMappingObject">
<id name="id" column="id"
type="java.lang.Integer">
</id>
<property name="name"
column="name"
type="java.lang.String" />
<set name="childIds"
table="REL_TABLEA_TABLEB"
lazy="false"
batch-size="50"
cascade="none" fetch="join">
<key column="TABLEA_ID"></key>
<element type="java.lang.Integer" column="TABLEB_ID"></element>
</set>
</class>
</hibernate-mapping>
class MyMappingObject {
Integer id;
String name;
Set<Integer> childIds
}
...
session.createSQL("select id, name from tableA").addEntity(MyMappingObject .class).list()
...