Dear Gehel & nbhatia


Here's mine ...





public class ActorTable {

   

   public void testMe()

   {

      Person person = Person.Factory.newInstance(); 
// Person is subclass of Actor

      

      System.out.println(" * * * Building target 
<Person> object * * *"&#41;;

&nbsp; &nbsp;&nbsp; &nbsp;

&nbsp; &nbsp;&nbsp; &nbsp;Configuration cfg = new Configuration&#40;&#41;

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;.addClass&#40;net.justtrade.realworld.persistence_layer.Actor.class&#41;

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;.setProperty&#40;"hibernate.dialect", 
"org.hibernate.dialect.MySQLDialect"&#41;

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;.setProperty&#40;"hibernate.connection.url", 
"jdbc&#58;mysql&#58;//localhost&#58;3306/vouchers"&#41;

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;.setProperty&#40;"hibernate.connection.driver_class", 
"com.mysql.jdbc.Driver"&#41;

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;.setProperty&#40;"hibernate.connection.username", "mv"&#41;

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;.setProperty&#40;"hibernate.connection.password", "andromda"&#41;

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;;

&nbsp; &nbsp;&nbsp; &nbsp;SessionFactory sessFact = 
cfg.buildSessionFactory&#40;&#41;;

&nbsp; &nbsp;&nbsp; &nbsp;HibernateTemplate template = new 
HibernateTemplate&#40;sessFact&#41;;

&nbsp; &nbsp;&nbsp; &nbsp;template.setExposeNativeSession&#40;true&#41;;

&nbsp; &nbsp; &nbsp; &nbsp; 

&nbsp; &nbsp;&nbsp; &nbsp;PersonDaoImpl persDao = new PersonDaoImpl&#40;&#41;;

&nbsp; &nbsp;&nbsp; &nbsp;persDao.setHibernateTemplate&#40;template&#41;;

&nbsp; &nbsp;&nbsp; &nbsp;

&nbsp; &nbsp;&nbsp; &nbsp;persDao.openMySession&#40;&#41;;

&nbsp; &nbsp;&nbsp; &nbsp;

&nbsp; &nbsp;&nbsp; &nbsp;person = &#40;Person&#41; 
persDao.create&#40;"Matilda", "Marketmaker"&#41;;

&nbsp; &nbsp;&nbsp; &nbsp;

&nbsp; &nbsp;&nbsp; &nbsp;persDao.releaseMySession&#40;&#41;;

&nbsp; &nbsp;&nbsp; &nbsp;

&nbsp; &nbsp;&nbsp; &nbsp;System.out.println&#40;"Person is " + 
person.getFirstName&#40;&#41; + " " + person.getPrincipalName&#40;&#41;&#41;;

&nbsp; &nbsp;&nbsp; &nbsp;

&nbsp; &nbsp;&#125;

&#125;





... and this created within my eclipse test, and preceding the AndroMDA 
generated one in the class path...





package net.justtrade.realworld.persistence_layer;





/**

&nbsp;* @see net.justtrade.realworld.persistence_layer.Person

&nbsp;*/

public class PersonDaoImpl

&nbsp; &nbsp; extends net.justtrade.realworld.persistence_layer.PersonDaoBase

&#123;

&nbsp; &nbsp;private org.hibernate.Session session;

&nbsp; &nbsp;

&nbsp; &nbsp;public void openMySession&#40;&#41;

&nbsp; &nbsp;&#123;

&nbsp; &nbsp;&nbsp; &nbsp;session = super.getSession&#40;&#41;;

&nbsp; &nbsp;&#125;

&nbsp; &nbsp;

&nbsp; &nbsp;public void releaseMySession&#40;&#41;

&nbsp; &nbsp;&#123;

&nbsp; &nbsp;&nbsp; &nbsp;System.out.println&#40;"***************&nbsp; Killing 
it?&nbsp; *****************"&#41;;

&nbsp; &nbsp;&nbsp; &nbsp;super.releaseSession&#40;session&#41;;

&nbsp; &nbsp;&#125;

&#125;







It compiles and runs without error.  It just won't send the poxy commit!  :x 



And I can't tell whether it's because closing the session doesn't necessarily 
mean sending a commit, or whether I'm closing a different session.




Quote:


Do you have an public accessor to the HibernateTemplate generated on your DAO ? 


(end of quote)




Your xyzDAOBase extends 
org.springframework.orm.hibernate3.support.HibernateDaoSupport from the Spring 
Framework.

http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/orm/hibernate3/support/HibernateDaoSupport.html
--
Regards,

Hasan
_________________________________________________________
Reply to the post : http://galaxy.andromda.org/forum/viewtopic.php?p=3458#3458
Posting to http://forum.andromda.org/ is preferred over posting to the mailing 
list!


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Andromda-user mailing list
Andromda-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/andromda-user

Reply via email to