Apa EJB tuh? Monday, Aug 20 2007 

Definisi EJB;

“Enterprise JavaBeans (EJB) is an architecture for setting up program components, written in the Java programming language, that run in the server parts of a computer network that uses the client/server model

Sederhananya, EJB itu ada 3 macam; Session Bean , Message Driven Bean, dan Entity Bean.

Message Driven Bean, itu fungsinya kayak listener buat nerima pesan yang dikirim lewat jalur JMS secara asyncronous.
Entity Bean tuh componen yan berfungsi buat mem-persist data. Artinya, kalo aplikasi kamu itu database centric, maka data-data kamu itu di query pake entity bean. Entity bean ini umumnya mewakili tabel-table kita di database.Nah kalo session bean, umunya buat kamu naro2 bussines process. Session bean bisa aja kamu melakukan query make si Entity Bean, entah nge-insert , nge-query, ato nge-update database.

Setiap Bean (ketiga bean) bisa saling berinteraksi satu sama lain. Saling menggunakan satu sama lain….

contoh Message Driven Bean ;


package id.mujoko.mit.ejb.mdb;

import id.mujoko.mit.ejb.beans.MessageContent;
import id.mujoko.mit.ejb.stateless.MessageEngine;

import java.util.Date;

import javax.annotation.Resource;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.EJB;
import javax.ejb.MessageDriven;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
(more…)

Basic Command Saturday, May 19 2007 

To add privilege recursive to the user, normally from the unzip file 

santi>chmod ugo+x -R  [directory name]

To show txt file in console

santi>tail -f [file name ]

To show current directory:

santi> pwd

Create connection with ssh protocol

santi> ssh username@remot_ip

example

santi>ssh joko@172.25.99.36

then they will ask user to enter password of the username

password :

Have fun

Killing running proccess

ps aux | grep xxxxx

xxxxx is the process that contain this world. Example, to know isd of eclipse that is running is

ps aux|grep eclipse

then we know sid of eclipse from the number in the most left like

ffp 6104 0.0 0.0 10468 892 ? S May18 0:00 /home/dridza/bin/eclipse/eclipse

6104 is the sid the eclipse

and to shut the process,

kill -9 6104

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.

« Previous PageNext Page »