Newbie, Seam & EJBTransactionRolledbackException
germandev.net-seam.wje-online.de Mar 13, 2009 11:51 PMHi!
Seam is quite new for me. I bought the book JBoss Seam - Simplicity and power beyond Java EE
and tried to reproduce the first example using JBoss AS 4.2.3.GA and Seam 2.1.1 GA, Eclipse and the JBoss Tools.
These are the steps I made:
1) Created a new project mySeamTest
using JBoss Tools
- EAR
- Bound to existing MySQL Database, ping was successful
- Chose the packages myseamtest.entity
and myseamtest.session
2) The JBoss Tools created three subprojects (mySeamTest-ear, mySeamTest-ejb, mySeamTest)
3) I created a new Java class under mySeamTest-ejb \ ejbModule
\ myseamtest.entity \
-- Person.Java --
@Entity @Name("person") public class Person implements Serializable { private static final long serialVersionUID = 1L; private long id; private String name; @Id @GeneratedValue public long getId() { return id;} public void setId(long id) {this.id = id;} public String getName() {return name;} public void setName(String name) {this.name = name;} }
4) Created two new files under mySeamTest-ejb \
ejbModule \ myseamtest.entity
-- Manager.java --
@Local public interface Manager { public String sayHello (); }
-- ManagerAction.java --
@Stateless @Name("manager") public class ManagerAction implements Manager { @In @Out private Person person; @Out private List <Person> fans; @PersistenceContext private EntityManager em; public String sayHello() { em.persist(person); person = new Person(); fans = em.createQuery("select p from Person p").getResultList(); return null; } }
5) Created the related page
-- (Important part of) test.xhtml --
<h:form> Please enter your name:<br/> <h:inputText value="#{person.name}" size="15" /> <br/> <h:commandButton action="#{manager.sayHello}" value="Say Hello" type="submit" /> </h:form> <h:dataTable value="#{fans}" var="fan"> <h:column> <h:outputText value="#{fan.name}" /> </h:column> </h:dataTable>
When I am going to deploy that project the page is loaded correctly and no error is shown in the console. But when I try to type something in the textbox and then click on the submit button, the following exception(s) appear: http://nopaste.info/17240bf0d7.html
Do you have any idea what I can try to solve that problem?
Thank you so much in advance!