Thanks Davor, I got it working, although it seems to require a
myentity.hbm.xml, specified via the hibernate.cfg.xml. I was hoping I could use the @Entity, @Id, etc, annotations in my entity classes instead. From the Hibernate docs, it seems like enabling these "Hibernate Annotations" requires a special instantiation of a hibernate session factory, which I am not sure if Tapestry-Hibernate does at the moment--I'll have to dive into the source when I have time. In any case, it seems to work without problems. On 6/7/07, Davor Hrg <[EMAIL PROTECTED]> wrote:
HibernateSessionManager being internal means you shouldn't be managing it your self. it's ok to : @Inject private HibernateSessionManager _sessionmanager; but creating it manualy is not a good solution, keep just the inject and tapestry ioc will provide it for you, Davor Hrg On 6/6/07, Daniel Jue <[EMAIL PROTECTED]> wrote: > > Thanks Davor. > > I think I'm going to use my domain POJOs as the "entities", and they > currently live in the package > > myapp/model/domain > > I think this should be ok, since EJB3 entities are POJOs, from what I've > read. > > So I will use that snippet of code to contribute the > myapp/model/domain package, and Tapestry should have it's way with the > pojos there. > > In my page classes I want to do something like this: > @Inject private HibernateSessionManager _sessionmanager; > > (I have a feeling I want the manager instead of just a session.) > > Now, in my AppModule.java, I've added these things: > > public void contributeEntityPackages(Configuration<String> configuration) > { > configuration.add("myapp.model.domain"); > } > public HibernateSessionManager buildSessionManager() > { > return new HibernateSessionManagerImpl(new > HibernateSessionSourceImpl(null, null, null)); > } > > Besides the nulls, am I on the right track here, instantiating the > Tapestry Hibernate internal classes (impl classes are in a package > called Internal)? > I am unsure on how to fill in the constructor for > HibernateSessionSourceImpl: > > HibernateSessionSourceImpl(Log log, Collection<String> packageNames, > ClassNameLocator classNameLocator) > > I thought i was specifying the package names in the > contributeEntityPackages method. > For classNameLocator I can just put new classNameLocator(). > > Alternatively, should I be creating a HibernateSessionSource through > bind, or is build* the way to go? > > Thanks, > > Daniel > > On 6/6/07, Davor Hrg <[EMAIL PROTECTED]> wrote: > > you use HA along with t5, > > > > t5 just supports it naturaly, > > if you put the entities in the entities package t5 will find them > > and add them to config. > > then, all you need is hibernate.cfg.xml containing connection data > > > > I'm leaving office right now so sory for a such short reply.. > > > > Davor Hrg > > > > On 6/6/07, Daniel Jue <[EMAIL PROTECTED]> wrote: > > > > > > Hi all, > > > > > > I am just getting started with Hibernate in my Tap 5 application, and > > > I'm kind of manually setting up Hibernate using the standard > > > HibernateUtils static methods and xml files for my domain objects. It > > > is working, although it's not elegant. > > > > > > > > > Now, I thought it would be good to explore this Hibernate-Annotations > > > [HA] library that is compatible with Hibernate 3.2+. It seems that > > > with this lib, I can set up Hibernate as well as set up the entity > > > objects (although the annotations in the Hibernate docs seem to come > > > from the javax.persistence.* package which is used for EJB3s), and rid > > > myself of xml set up files. > > > > > > Now from the small snippet of code on Tapestry-Hibernate [TH5], I see > > > that you can do your Hibernate configuration there, and it will also > > > set up your entities. However, I don't know the full ambition of this > > > library--would it replace the need for HA? > > > > > > Put another way, > > > > > > If I was using TH5, do I need to have the .hbm.xml files for my > > > entities, or can I use HA, or is TH5 going to create the HA for me ? > > > > > > I know this is alpha, an answer based on intended behavior is fine. > > > > > > Daniel > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]