geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mattias Malmgren <matt...@freefarm.se>
Subject J2EE EJB design question
Date Mon, 02 Oct 2006 10:37:13 GMT
Hi

Perhaps out of topic, but anyway, this is my question:

As far as I can understatnd, an enity EJB can not have business methods, 
just getter/setter methods for the, in the database underlaying fileds in a 
table, along with the methods in the EntityBean interface.

Say I have an Employee object like this:

class Employee {
	int id;
	String name;
	double salary;
	
	void changeSalary(double percentage) {
		salary = salary + (salary * (precentage / 100));
	}
	void save() {
	    myDatabase.saveEmployee(this);
	}
}

Using EJB what do I do? In an enity EJB I can't have the changeSalary 
method? If I have it as a Session Bean, I can't have presistance and save 
the objects data? What is the design soulotion?

Best regards // Mattias 



Mime
View raw message