Hi all,
I want to use stateless session to insert an object Quote, having a map collection, in databse.
I know that collections are ignored in stateless sessions but can there be any work around for this???
As i don't really want to use JDBC for just this one when I am using hibernate through out my application.
Following is my code:
Code:
Class Quote{
String source;
SortedMap bids = new TreeMap();
}
mapping file is :
Code:
<class name="Quote" table="QUOTE">
<id name="id" column="QUOTE_ID">
<generator class="sequence">
<param name="sequence">seq1</param>
</generator>
</id>
<property name="source" column="source"/>
<map name="bids" table="BIDS" sort="natural">
<key column="quote_id"/>
<index column="price"/>
<property name="type"/>
</map>
</class>
problem is there are no records corressponding to bids map in BIDS table. Only QUOTE table is getting populated with records.
following is my code to save the object:
Code:
void writeQuote(Quote quote) {
StatelessSession session = sessionFactory.openStatelessSession();
Transaction tx = session.beginTransaction();
session.insert(quote);
tx.commit();
session.close();
}
Any bright ideas???
Any help appreciated.
Thanks