Exception EJB 3 dan Transaction, Friday, Mar 14 2008 

Exception dalam lingkup EJB 3 di bagi menjadi 2; Aplication Exception dan System Exception. Yang masuk dalam katagori aplication exception adalah exception-exception yang terjadi terkait dengan bussines logic, contohnya adalah exception yang terjadi karena jumlah pembayaran lebih besar dibandingkan account balance client.System Exception sendiri terkait dengan exception yang terjadi karena system, seperti koneksi database yang tidak tersedia.

System exception secara otomotis transaction di roll back, sedangkan aplication exception mesti di tentukan tingkah lakunya, apakah akan di rollback atau tidak.

Entity Bean of EJB 3 Wednesday, Apr 25 2007 

The taste of beans in EJB are Session, Entity and Message driven Bean. Entity Bean is persistent. Persistent means being written the hard disk or another kind storage media. Entity bean is close to Database, what we create it and make it persist just like insert into database.

EJB 3 used annotation feature that belong to java 5 or above. Entity Bean 3 is simpler then EJB 2. Before EJB 3, developver have to declare all setting in xml file, to map the entity and the table is teh example. Also required extends EJBObject and create interfaces for all of them.

Now it is simpler for developer. Just create PAJO(Plain Annotation Java Object) , then add @Entity above of the class.

example
@Entity
public class Customer implements Serializable{
@Id
private Long myID;
private String name;
private String address;
:
:

}
The three member variable of Customer is mapped as the field of Customer Table by default. The name of the table, if not declared @Table(name=”" ),will use Class name, in this case Customer table. Don’t forget to add setter and getter for each member variable.

Implement serializable why? now we’re working in many JVM or client and server is separated. then we cannt use passing by reference anymore. Object is passing by value and remote client can have object that exactly same as in the container.

SFSB alias Statefull Bean Error in JDK 6 Thursday, Apr 19 2007 

The way is not smooth as I imagine before. I was imagine EJB 3 is easier then EJB 2. After trying some simple code for Stateles Bean and Entity Bean, then I try Stateful Bean. SLSB and Entity bean has no big deal to try, but when I try SLSB in the same environment, I got error.

I used java jdk 1.6 and JBoss 4.05. I just down load sample code of stateless, statefull and entity bean and try to deploy and run it. Stateless and entity bean is ok as I expected, but for stateful has a problem with class loader. Then i try to search by googling and I found this thread in forum of JBoss.

Then I changed my environment, switch to Tiger (jdk 5) again, and its work as I expected. Its also work in JBoss 4.0.4 and used jems.installer with ejb feature.

Welcome and go for the next step :)

Mujoko

Next Page »