I am newbie in the Java EE world. To improve my programming experience I chose the JBoss Developer Studio, and the JBoss AS 7 server with MySQL database. I use these tools in Fedora 20.
JBoss has a sample application (i attached) and I would like to create my own simple sample application like this example. The kitchensink sample use xml to store data, I'm using MySql.
I cannot insert to data from jsf page. If I tried I've got this message to the consol:
INFO [com.itemsapp.service.ItemInsertion] (http-localhost-127.0.0.1-8080-1) Inserting Lenovo
INFO [javax.enterprise.resource.webcontainer.jsf.renderkit] (http-localhost-127.0.0.1-8080-1) WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
sourceId=null[severity=(ERROR 2), summary=(JBAS011469: Transaction is required to perform this operation (either use a transaction or extended persistence context)), detail=(Insertation unsuccessful)]
But if I insterted data maunaly, I could get the that from the database as you can see on the attached picture.
INSERT INTO `itemsapp`.`ITEM`(`ITEM_ID`,`ITEM_PRICE`,`MODEL_NO`,`NAME`,`TOTAL_NO`)VALUES(1,250,"Inspiron 3520","DELL",12);SELECT * FROM itemsapp.ITEM;
I archived my project from jbdevstudio, and i attached it.
What am i doing wrong?
Does someone have any idea how to change this code?
Thank you in advance for any help you can provide.
I guess I solved this problem.
At the com.itemsapp.service package i annotated the ItemInsertion class with @Stateless annotation.
Now i've got the
sourceId=null[severity=(INFO 0), summary=(Inserted!), detail=(Insertation successful)]
And i can see the data in the db and the listItems.xhtml too.