N
nospawn
Hi all,
I am new to Hibernate and need some directions here ...
I basically need Hibernate to allow me mapping any table to some
generic type i.e. Map or HashMap-derived class. I can not rely on a
strongly typed DAO not even a generic one. I need Hibernate to do the
mapping from any given table.
I would like to do something like:
class MapsToAny extends HashMap<String, Object> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="MapsToAny" table="order_new">
<map name="this?">
<key column="order_id"/>
<index column="order_id" type="string"/>
<element column="order_desc" type="string"/>
</map>
</class>
<class name="MapsToAny" table="order_old">
<map name="this?">
<key column="order_id"/>
<index column="order_id" type="string"/>
<element column="order_desc" type="string"/>
</map>
</class>
</hibernate-mapping>
At most I would like to retrieve the data into a Collection, so I can
manipulate it later on but be able to specify outside code what the
query should be.
Any ideas?
TIA,
Best Regards,
Giovanni
I am new to Hibernate and need some directions here ...
I basically need Hibernate to allow me mapping any table to some
generic type i.e. Map or HashMap-derived class. I can not rely on a
strongly typed DAO not even a generic one. I need Hibernate to do the
mapping from any given table.
I would like to do something like:
class MapsToAny extends HashMap<String, Object> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="MapsToAny" table="order_new">
<map name="this?">
<key column="order_id"/>
<index column="order_id" type="string"/>
<element column="order_desc" type="string"/>
</map>
</class>
<class name="MapsToAny" table="order_old">
<map name="this?">
<key column="order_id"/>
<index column="order_id" type="string"/>
<element column="order_desc" type="string"/>
</map>
</class>
</hibernate-mapping>
At most I would like to retrieve the data into a Collection, so I can
manipulate it later on but be able to specify outside code what the
query should be.
Any ideas?
TIA,
Best Regards,
Giovanni