Hey!

> public class HbAction {

Just a tip... I've seen you named your page Class as "HbAction"... it seems
you've come from Struts, right? If you did, keep in mind that Tapestry is
not Action Oriented (like Struts), it is "Component Events Oriented" (like
wicket or sorta like jsf). It means you can't, for example, have multiple
views per action, modeling an usual mvc app structure like you do on Struts.

> package Entities;

PascalCase package names... well, it's not my point anyways. Another tip: It
seems your App Root Package is "hb", so inside of it you should have
"hb.pages", "hb.services", "hb.components" etc. right? If you create a
package named "hd.entities" and put your Hibernate Pojo's (like
"Hello.java") inside of it, Tapestry Hibernate will automagically map it.
So, there's no need to map your beans via hibernate.cfg.xml or
programatically.


Regards,

_______________________
Everton Agner Ramos


2010/11/30 Kristian Marinkovic <kristian.marinko...@porscheinformatik.at>

> you have to add the tapestry-hibernate-core dependency to your classpath
> as well... it contains the annotation CommitAfter
>
> g,
> kris
>
>
>
> Von:    robnangle <robnan...@gmail.com>
> An:     users@tapestry.apache.org
> Datum:  30.11.2010 11:27
> Betreff:        First Tapestry app with Hibernate
>
>
>
>
> Hi all,
> Sorry if this has been posted before.
>
> Ive been trying to get going with a few examples of hibernate with
> tapestry
> with no success.
>
> The two main errors i keep gettin are:
>
> org.apache.tapestry5.internal.services.TransformationException:
> java.lang.ClassNotFoundException:
> org.apache.tapestry5.hibernate.annotations.CommitAfter
>
> org.apache.tapestry5.internal.services.TransformationException:
> javassist.NotFoundException: org.hibernate.Session (when i take out the
> commit after)
>
> HbAction.java:
>
>
> package hb.pages;
>
> import java.util.List;
>
> import org.apache.tapestry5.hibernate.annotations.CommitAfter;
> import org.apache.tapestry5.ioc.annotations.Inject;
> import org.hibernate.Session;
> import Entities.Hello;
>
> public class HbAction {
>
>                 @Inject
>                 private Session _session;
>
>                 private Hello   current;
>
>                 @CommitAfter
>                 public void onAction() {
>                                 Hello h = new Hello();
>                                 h.setMessage("Hello World");
>                                 _session.save(h);
>                 }
>
>                 public List getList() {
>                                 return
> _session.createCriteria(Hello.class).list();
>                 }
>
>                 public Hello getCurrent() {
>                                 return current;
>                 }
>
>                 public void setCurrent(Hello current) {
>                                 this.current = current;
>                 }
>
> }
>
> Hello.java:
>
>
> package Entities;
>
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.Id;
> import javax.persistence.Table;
>
>
>
> @Entity
> @Table(name="hello")
> public class Hello {
>
>                 @Id
>                 @GeneratedValue
>                 private long id;
>                 private String message;
>
>                 public long getId() { return id;}
>
>                 private void setId(long id) { this.id = id; }
>
>                 public String getMessage() { return message;}
>
>                 public void setMessage(String message) { this.message =
> message;}
> }
>
> HbAction.tml:
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>    <head>
>        <title>Hibernate example app</title>
>    </head>
>    <body>
>    <t:loop source="list" value="current">
>    ${current.message}<br/>
>    </t:loop>
>    <t:ActionLink>add</t:ActionLink>
>    </body>
> </html>
>
>
> Cheere if anybody can help..
> --
> View this message in context:
>
> http://tapestry.1045711.n5.nabble.com/First-Tapestry-app-with-Hibernate-tp3285845p3285845.html
>
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>
>

Reply via email to