Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,670 members, 7,809,537 topics. Date: Friday, 26 April 2024 at 10:58 AM

Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 (4392 Views)

In Nigeria, Why Does It Seem So Hard To Find People Interested In Programs? / Nawa Ooo , They No Wan Leave My New Topic For People To View / What's new in PHP 5 and PHP 6 (2) (3) (4)

(1) (2) (Reply) (Go Down)

Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 5:31am On Mar 11, 2006
Hello, is there anybody interested in exploring the new JavaEE 5 and Sun Application Server 9.0(Beta). It's going to
like everybody doing same thing and sharing ideas, solutions and materials. I bet you apart from few write up
by few people and the various specifications from Sun, there isn't a book on it that i know.
Bet it's going to be fun.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by Seun(m): 2:10am On Mar 12, 2006
What's new in JavaEE 5 and what are the pages to read to get acquainted with it?
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 2:44am On Mar 12, 2006
Seun, there is alot of changes between j2EE and JavaEE. The power of J2SE 5.0 was brought to bear on JavaEE 5.0. Look at the introduction of
annotations, beans implementing the business interface( component interface) and much more. If you are interested, i am still working out the sharing
formula. Thinking of setting up an e-mail add where anybody could either upload or download exchanged materials from. Or can you give us such access
through this site.
Hoping to hear from you.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by sbucareer(f): 4:17am On Mar 12, 2006


mimoh_mi, you know in J2EE 1.4 we have the container implementing four interfaces namely:

1. Remote Bean Interface
2. Home Bean Interface
3. Business Bean Interface
4. Entity/Session Bean interface


I am using netbean 5.0 for my IDE+Application server and also I am using Mysql 4.1.11 with mysqlconnector-java-5.0.0-bin.jar drive. In the application server i.e. http://localhost:4848 I have setup the connection pool and ping the database successfully. Also I use the the name "bank" as my JNDI.

The the application I am developing, my EJB Module named is called "MyBank" and have a session bean with stateless persistent, which allows user to login to their bank account. The session bean is the Facade, and has a DAO (Data Access Object) that encapsulate the database. The session bean of course talks to the Entity bean of CMP.

Now, I want to implement the rest of the business rules as local bean and use Message-Driven Bean and only expose the stateless session bean facade as Remote object and let the rest of the Entity beans both CMP/BMP communicate with the client through the facade bean.

The problem I am having well not really problem but more of an opinion is that, which way do you think is the best to implement this logic of exposing the facade bean by making it Remote object and the rest Local object? Would it have a pay back in terms of over protective and security issues?

Finally, I am using JSFL in Sun AppServer 1.4 do you have any good material for this or are you using another framework for web application controls?

Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by sbucareer(f): 1:12am On Aug 06, 2006

Mimoh_mi, you did mot answer my question? Are you clueless to this problem, because it has come back to hunt me. I need to convince someone regarding this issue. Not just Mimoh_mi, but anyone that understands J2EE 1.4

Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by clocky(m): 12:53pm On Aug 08, 2006
if u are using Spring. its dead easy . configure your remote bean in the application context file using springs
SimpleRemoteStatelessSessionProxyFactoryBean
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 1:28am On Aug 18, 2006
Hi sbucareer,
Sorry for the break. I have been out for a while now. To your question. Personally,
and from other sources, when developing a Java EE application, there are more things
to be considered when it comes to persistant. With the facade pattern the business logic
is often place in both the session and entity beans.
Come to look at it, it is often advisable to put all business related logic that has to
do with persistant entity in entity bean class, why ? It enable us to take the advantage
of the container services like transaction and co. If we are going to use a CMP (Most times)
we need to expose it's local interface to the session bean.
Next is what type of session bean, come to think of it, since it is a banking app, there is
the need to maintain a conversational state as per client as this can easily be propergated
across multiple method call, thus making security and transaction handling easy.

So, what the facade class will normally do is just to handle the app workflow. Like call the
stateful session bean methods , the session bean calls the entity bean to supply the required data.
Making a decision whether to expose local or remote interface of the bean require a lot of trade off like,
location, parameter call ie either call by value or by reference, network and scalability.

I will go for all local interfaces for both bean and let the facade handle the work flow. So all the client
will ever call is my facade class. Hope it help. I will send you a book on design patterns for EJB.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by clocky(m): 12:19pm On Aug 18, 2006
mimoh_mi

i'm just a little bit curious why u are going the EJB route. Working properly wit Ejbs can be really combersome. Have u tried Spring. It gives u d flexibilty of creating an enterpriese application in a more intuitive way. I think the current Ejb implementation is very limited in its practicality especially in the Bussiness tier of a web application when compared to a framework like Spring
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by sbucareer(f): 2:55pm On Aug 18, 2006

Mimoh_mi thanks for your recommendations and guide. I have solved the problem or rather recommended my perception to the client that needed this advice.

@Clocky
EJB, is the fundermental place to start learning your Enterprise Java solution. When you have learned EJB, migrating to other framework like Spring will be a walkover for you.

Thanks Mimoh_mi
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 12:09am On Aug 23, 2006
Hey Clocky,
If i may say, the new Java EE, though just new will definitely top the list of enterprise framework. Do agree with you on the J2ee 1.3 - 1.4
implementations but all those problems have be taken care of in this new version. In fact, entity bean is heading for the bin soonest, instead
we now have persistant managers and class just the same POJO, that the spring framework offers. Let me just show a simple application.


This is the new interface.

import javax.ejb.*;


//this is a remote interface
@Remote
public interface AdviceRemote {

// exposed business method

public String getAdvice();
}

The bean

import javax.ejb.*;

//Show that it's a stateless bean

@Stateless
public class AdviceBean implements AdviceRemote {

public AdviceBean() {
}

//Business methods

public String getAdvice(){
return "Do not u think this is cool";
}

}


OK, the client


import javax.ejb.*;

public AdviceClient {

//inject JNDI name
@EJB() AdviceRemote advice;
public String hearAdvice() {

// call your business method
return advice.getAdvice();
}
}

As you can see you no longer have to implements all those callback methods. You just have a greater control.
Cheers

Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by clocky(m): 11:38am On Aug 23, 2006
Yea i know about the new EJB annotations which makes it more easier to code POJO based Ejb and get rid of messy xmls . However i still think the current implementation is still lacking in a lot of features which comes out of the box in Spring

for example

- There is no ability to manage finer-granined objects that might not want to put in the JNDI. from what i have seen so far EJB is still tightly coupled wit the JNDI namespace.

- To be able to use the EJB annotations u require java 1.5 and this is not backward compatable wit other java versions therefore existing classs can not be easily reused

- The is no way you can handle singletons(Shared instances) and prototypes(seperate instance per user) objects as can be done in Spring.

- Support is limited only to primitive types. there is no support for complex types like Maps and Lists


I still think to use EJB effectly u will still need to use it within Spring but i guess more changes would still be made to the future versions of the spec
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 11:53pm On Sep 10, 2006
@Clocky
Thanks for forcing me to learn the spring framework, you were quite wright on your points, but come to think of it
subcareer was also wright on migrating to spring from java ee. Just within 2 weeks of studying i am almost comfortable
using the spring framework. I will want to say that lot of XML configuration and interface implementation are involved, also the api aren't that simple for beginners to learn. but am still more comfortable with the ejb stuff.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 12:38pm On Sep 11, 2006
from my experience ejb 3 is still tightly coupled to the app server. The ease of use u are talking about is sacrificed for flexibility which spring has.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 11:37pm On Sep 12, 2006
@candylips
Hey I tend to agree with you, but come to think of it, why would you want to develop an enterprise application,
you must need a java ee environment to deploy you application. The java ee design pattern is the basic pattern which all other
pattern must meet to be java e e compliant.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 11:29am On Sep 13, 2006
wel that is where spring is a beauty. You can develope a full scale Enterprise Java application that has things like messaging, transaction management, fault tolerance , caching etc with a simple servlet engine like Tomcat or jetty if u go the Spring route. You are not tied in any way to a particluar application server (which is usually the case if u are using Websphere , Jboss etc. and if at any point in time u want to use an application server. u can easily deploy the app unchanged to the app server of your choice without any code change. That is the beauty Spring's flexibilty gives u which ejb doesn't have.

For example configuring JMS or Transaction Management is Jboss is totally different from the way u will do it in Websphare and ofcourse your configuration would not work in Tomcat. But with Spring. once u configure your beans in the application context you are good to go in any enviroment u deploy it in.


If u wanna know more about spring i can recommend books tutorial etc . It is in my view the best thing that has happend to Java in a long while
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by sbucareer(f): 2:04pm On Sep 13, 2006

@candylips

Please can you post your recommended book(s) for spring. Could you also recommend an appServ for spring? Thanks a bunch. If you have time could you touch JMS or Transaction management on spring?

Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 2:24pm On Sep 13, 2006
ok i use two books

1 .Spring in action by Craig Walls (http://www.amazon.com/Spring-Action-Craig-Walls/dp/1932394354/sr=1-2/qid=1158153535/ref=pd_bbs_2/103-7483390-6139018?ie=UTF8&s=books)

2. Pro Spring by Rob Harrop (http://www.amazon.com/Pro-Spring-Rob-Harrop/dp/1590594614/ref=pd_sim_b_3/103-7483390-6139018?ie=UTF8)


Do you know how to use spring ? if you currently do i can take you through how to set up transactions and how to use JMS . Let me know
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by sbucareer(f): 2:50pm On Sep 13, 2006

Yes, but go ahead I might learn some new tricks from you. How do you set up JMS in spring?

I am on my lunch break and I am on my way to get those two books now.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 3:34pm On Sep 13, 2006
To work with JMS u need to set up a couple of configurations in the application context file. once u have done these u will be able to have access to the underlying messaging platform over a very simple interface

am just gonna rip out the configuration in one of my code

First u need to configure the jnditemplate

<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">
org.jnp.interfaces.NamingContextFactory
</prop>
<prop key="java.naming.provider.url">
localhost
</prop>
<prop key="java.naming.factory.url.pkgs">
org.jnp.interfaces:org.jboss.naming
</prop>
</props>
</property>
</bean>

next u configure the queue connection factory

<bean id="jmsQueueConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate"/>
</property>
<property name="jndiName">
<value>UIL2ConnectionFactory</value>
</property>
</bean>

then u will need to define 2 jms destinations for sending and receiveing messages.
<bean id="sendDestination"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate"/>
</property>
<property name="jndiName">
<value>queue/RequestSendQueue</value>
</property>
</bean>

<bean id="receiveDestination"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate"/>
</property>
<property name="jndiName">
<value>queue/ReqeustReceiveQueue</value>
</property>
</bean>
The queues ReqeustReceiveQueue and RequestSendQueue should be define in ur app server

next u need a reference to the jms template which helps abstract the jms api from ur application

<bean id="jmsTemplate"
class="org.springframework.jms.core.JmsTemplate102">
<property name="connectionFactory">
<ref bean="jmsQueueConnectionFactory"/>
</property>
<property name="defaultDestination">
<ref bean="destination"/>
</property>
<property name="receiveTimeout">
<value>40000</value>
</property>
</bean>


Finally in my case i have defined two beans that help me with the sending and recevieing of messages.
Defining it here will give u d abiliy of using them anywhere in ur app. so u can message enable anything in ur app

<bean id="jmsSender" class="org.informa.jms.JMSSender">
<property name="jmsTemplate">
<ref bean="jmsTemplate"/>
</property>
</bean>

<bean id="jmsReceiver" class="org.informa.jms.JMSReceiver">
<property name="jmsTemplate">
<ref bean="jmsTemplate"/>
</property>
</bean>



Once u have don these configurations to send a message in ur code is as simple as just wrting,

JMSSender jmsSender = (JMSSender)appContext.getBean("jmsSender"wink;

jmsSender.sendMesage();



i hope these helps . let me know if u need more help
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 12:54am On Sep 14, 2006
@candylips
Thanks for your contribution. As earlier mentioned, you just forced me into the spring circle. But come to
think of it, despite the simplicity of the spring framework, i still feel that there are some situation where it might not
be appropriate to use spring, infact I am currently reading a book on EJB 3.0, nice book - Mastering EJB 3.0, it has a free
pdf version that can be downloaded for free @http://www.theserverside.com/tt/articles/index.tss, try and get
it, all you need is just register and the book and many more are yours.

Ok on my project, i strongly believe the best way to learn new technology is by trying it out. I am using netbean,
with a derby database. I just want to create say a Personnel Management System using the Spring framework.
I have Personnel table that holds each personnel data, Course table for courses attended by a particular personnel
and finally user table that holds user name and password. I have a class the represent that represent each table, DAO
and it's implementer class for each table, my question is do i need to create a controller servlet for each class -- ie table ?
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 8:11am On Sep 14, 2006
No you dont need a controller servlet to do that.

I am assuming that you want to use spring only for the middle-tier and DAO. so onces u have created ur DAOs and set up the required configurations in the application context. u can use it in even a normal servlet or any other web frameworks out there i,e struts, velocity etc.

However, Spring also has a MVC framework called Spring MVC and configuring it is just as easy as defining the bean in the application context and then thats it.

Do you want to use the full stack or u just want to use it for the DAO and middle-tier.

Post your code and i can maybe take u through what is required
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 12:22am On Sep 15, 2006
@candylips
Here are my codes for the personnel table. Am using the spring MVC framework

Personnel.java represents my personnel table

package com.navy.domain;

import java.io.Serializable;

/**
*
* @author Owner
*/
public class Personnel implements Serializable {
private int pid;
private String serviceNum;
private String name;
private String status;
private String addr1;
private String addr2;
private String city;
private String state;
private String zip;
private String phone;

/** Creates a new instance of Personnel */
public Personnel() {
}

public int getPid() {
return pid;
}

public void setPid(int pid) {
this.pid = pid;
}

public String getServiceNum() {
return serviceNum;
}

public void setServiceNum(String serviceNum) {
this.serviceNum = serviceNum;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getStatus() {
return status;
}

public void setStatus(String status) {
this.status = status;
}

public String getAddr1() {
return addr1;
}

public void setAddr1(String addr1) {
this.addr1 = addr1;
}

public String getAddr2() {
return addr2;
}

public void setAddr2(String addr2) {
this.addr2 = addr2;
}

public String getCity() {
return city;
}

public void setCity(String city) {
this.city = city;
}

public String getState() {
return state;
}

public void setState(String state) {
this.state = state;
}

public String getZip() {
return zip;
}

public void setZip(String zip) {
this.zip = zip;
}

public String getPhone() {
return phone;
}

public void setPhone(String phone) {
this.phone = phone;
}

}

DAO

package com.navy.dao;

import com.navy.domain.Personnel;
import java.util.Collection;

/**
*
* @author Owner
*/
public interface PersonelDao {
public Personnel getPersonnel(int pid);
public Collection<Personnel> getAllPersonnel();
}


My RowMapper class

package com.navy.dao.jdbc;

import com.navy.domain.Personnel;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;

/**
*
* @author Owner
*/
public class PersonnelRowMapper implements RowMapper{

/** Creates a new instance of PersonnelRowMapper */
public PersonnelRowMapper() {
}

public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
Personnel pers = new Personnel();
pers.setPid(rs.getInt("PID"wink);
pers.setServiceNum(rs.getString("SERVICENUM"wink);
pers.setName(rs.getString("NAME"wink);
pers.setStatus(rs.getString("STATUS"wink);
pers.setAddr1(rs.getString("ADDR1"wink);
pers.setAddr2(rs.getString("ADDR2"wink);
pers.setCity(rs.getString("CITY"wink);
pers.setState(rs.getString("STATE"wink);
pers.setZip(rs.getString("ZIP"wink);
pers.setPhone(rs.getString("PHONE"wink);

return pers;

}


}

My JdbcDAO


package com.navy.dao.jdbc;

import com.navy.dao.PersonelDao;
import com.navy.domain.Personnel;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.support.JdbcDaoSupport;

/**
*
* @author Owner
*/
public class PersonnelJdbcDao extends JdbcDaoSupport implements PersonelDao{

private PersonnelRowMapper rowMapper;

/** Creates a new instance of PersonnelJdbcDao */
public PersonnelJdbcDao() {
rowMapper = new PersonnelRowMapper();
}

public Personnel getPersonnel(int pid) {
Object result = getJdbcTemplate().queryForObject("select * from Personel where PID=?",
new Object[]{new Integer(pid)},
new int[]{Types.INTEGER}, rowMapper);

return (Personnel)result;
}

public Collection<Personnel> getAllPersonnel() {
Collection<Personnel> result = null;

List queryResults = getJdbcTemplate().query("select * from Personel", rowMapper);

if (queryResults != null) {
result = new ArrayList<Personnel>(queryResults.size());
for (Object o : queryResults) {
if (o instanceof Personnel) {
result.add((Personnel)o);
}
}
}

return result;
}


}

Service and DAO interfaces exposing the same methods.

package com.navy.dao;

import com.navy.domain.Personnel;
import java.util.Collection;

/**
*
* @author Owner
*/
public interface PersonelDao {
public Personnel getPersonnel(int pid);
public Collection<Personnel> getAllPersonnel();
}


service implementer


package com.navy.service;

import com.navy.dao.PersonelDao;
import com.navy.domain.Personnel;
import java.util.Collection;

/**
*
* @author Owner
*/
public class PersonnelServiceImpl implements PersonnelService{

private PersonelDao personelDao ;

/** Creates a new instance of PersonnelServiceImpl */
public PersonnelServiceImpl() {
}



public PersonelDao getPersonnelDao() {
return personelDao;
}

public void setPersonnelDao(PersonelDao personelDao) {
this.personelDao = personelDao;
}

public Personnel getPersonnel(int pid) {
return personelDao.getPersonnel(pid);
}

public Collection getAllPersonnel() {
return personelDao.getAllPersonnel();
}

}

Now the controller.

package com.navy.controller;

import com.navy.service.PersonnelService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;

/**
*
* @author Owner
*/
public class PersonnelController implements org.springframework.web.servlet.mvc.Controller{

private PersonnelService personnelService;

/** Creates a new instance of PersonnelController */
public PersonnelController() {
}

public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {

if (request.getParameter("pid"wink != null) {

int pid = new Integer(request.getParameter("pid"wink).intValue();

return new ModelAndView("personnel.jsp", "personnel", getPersonnelService().getPersonnel(pid));
} else {

return new ModelAndView("personnels.jsp", "personnels", getPersonnelService().getAllPersonnel());
}
}

public PersonnelService getPersonnelService() {
return personnelService;
}

public void setPersonnelService(PersonnelService personnelService) {
this.personnelService = personnelService;
}



}

cofig files

applicationcontext.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:comp/env/jdbc/pms</value>
</property>
</bean>


<bean id="personnelDao" class="com.navy.dao.jdbc.PersonnelJdbcDao">
<property name="dataSource">
<ref local="dataSource"/>
</property>
</bean>

<bean id="personnelService" class="com.navy.service.PersonnelServiceImpl">
<property name="personnelDao">
<ref local="personnelDao"/>
</property>
</bean>
</beans>

personnel-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- Create a mapping of URI's to Controller -->
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/personnels.do">personnelController</prop>
<prop key="/personnel.do">personnelController</prop>
</props>
</property>
</bean>

<!-- Provide the ProductController with access to an implementation of the
ProductService. The ProductService is defined in applicationcontext.xml -->
<bean id="personnelController" class="com.navy.controller.PersonnelController">
<property name="personnelService">
<ref bean="personnelService"/>
</property>
</bean>
</beans>

context.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/PMS">
<Resource auth="Container" driverClassName="org.apache.derby.jdbc.ClientDriver" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" name="jdbc/pms" password="admin" type="javax.sql.DataSource" url="jdbc:derby://localhost/pms" username="admin"/>
</Context>


web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<description>PMS</description>
<display-name>PMS</display-name>
<distributable/>
<context-param>
<description>Spring Application Context</description>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationcontext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>personnel</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>personnel</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
<resource-ref>
<res-ref-name>jdbc/pms</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>

Whao, hope not too much of stress, my question again, I still have to more tables for courses and signon, do i have
to have a diff controller for each or can i boundle all the logic in the personnel controller ?
Thanks for the guide, just learning.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by sbucareer(f): 3:22am On Sep 15, 2006

mimoh_mi, you can use one controller to map all the requests from the model or view, although I have just started reading Spring in Action by Craig Walls, Ryan Breidenbach. I will give you my comprehensive opinion next week.

You see spring is cumbersome, look at the heavy object wrapping, application-xml, web-xml, object-xml configuration.

If you have used EJB, it would not involve all the heavy object relational mapping and brusque xml configuration. I wonder why people are running away from EJB? EJB 3.0 is even much easier using annotations.

Mimoh_mi, why are you using Spring? Is it a learning curve? Do you think it is easier to EJB? Anyway, your simple Personnel Object is quite big and you have not even write their transport protocol yet within the application server i.e. JMS or JNDI

Finally, I think I will learn spring for argument sake, so when I am arguing with someone about spring I would know what to say in my defense. I will stick with my EJB 3.0 and I heard another one is on the way, you know it only gets better.

An ORM (Object Relational Mapping)  like Hibernate is better wrapper of Java Object and database, it uses less config file and load objects like Microsoft DOM (Document Object Model)
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 5:56am On Sep 15, 2006
@sbucareer

I quite agree with you, i am just going through the learning curve, for me i know that ejb3.0 is the way. But spring come to play
when we need to develop lightweight Java EE application, where transaction isn't much of requirements. Infact just some few moment
ago, while scratching the web for materials on Spring, I came across another version called Spring Work Flowhttp://www.springframework.org/download. The thing is just to used to more design pattern, because it's only
when you know the two before you can make a choice. Which book are you using for ejb3.0 ?
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by sbucareer(f): 10:51am On Sep 15, 2006

mimoh_mi, I am using candylips recommendation on spring book by Craig Walls and Ryan Breidenbach.

I have bought it and I am still going through it very slowly. As I am not a Spring guru, I followed candylips recommendation on it.

Mimoh_mi, please can you increase your font size to at least 11pt, thanks.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 12:14pm On Sep 15, 2006
ok let me respond

@sbucareer


You see spring is cumbersome, look at the heavy object wrapping, application-xml, web-xml, object-xml configuration.

If you have used EJB, it would not involve all the heavy object relational mapping and brusque xml configuration. I wonder why people are running away from EJB? EJB 3.0 is even much easier using annotations.


Spring is very flexible. What mimih_mi did was just to use the robust JDBC template and map the resultset back to his model himself. Spring supports all the major ORM tools out there including Hibernate, Ibatis, TopLink ,etc.

He could easily have written this code in his DAO

List queryResults = getJdbcTemplate().query("select * from Personel", rowMapper);

To List queryResults = getHibernateTemplate().find("from Personel"wink;

once his mappy files are present. spring would automatically use hibernate instead of spring jdbc and let hibernate take care of the mappring for him.

I have used Hibernate extensively and i must say it is not very pretty to use especially if u have a very complex object relationship.

Considering configuration. yes you need to do some xml configuration. This is the sacrifice you have to make for flexibility.
Tell me how will u use annotations in a project were Java 1.5 is not used. My company for example have been very reluntant to migrate the production server to Java 1.5 and even if there do.  I cannot reuse most of the objects i have in ejb without a hell load of refactoring. But this is not the case with spring.

So the reason why some people are reluntant about E.J.B 3 is

1. Its not very flexible
2. The features it gives are not much when compared with what Spring has to offer.

However another beauty here is that you can use EJB within Spring. Spring has a lot of wrappers for your stateless and statefull beans.


Mimoh_mi, why are you using Spring? Is it a learning curve? Do you think it is easier to EJB? Anyway, your simple Personnel Object is quite big and you have not even write their transport protocol yet within the application server i.e. JMS or JNDI

Finally, I think I will learn spring for argument sake, so when I am arguing with someone about spring I would know what to say in my defense. I will stick with my EJB 3.0 and I heard another one is on the way, you know it only gets better.



You guys would be better off learning both spring and EJB and actually using it before making any judgment. Thrust me i have been a very heavy EJB user before but when spring came along i found out that i had less worries with my session facades and all those messy stuff.
Once you are confortable with it. Believe me you wouldnt want to use anything else. or you would want to use it within your Ejb application.
Personally the reson why spring is so attractive is that it forces you to write good quality code. Something which is very valuable when you are working on a large project and you have a lot of interdependences.



@mimoh_mi

Looking at your code. You usually create controllers based on actions you want tto perform. So if the new tables you are talking about would required for example CRUD actions you will need to create controllers for them. However when you get more confortable with Spring MVC. You can actually have just a controller and have differnt methods within it for different actions.

Spring WebFlow is an implementation of the continuations concept . It makes the web tier stateful thereby giving you the ability to manage workflows for very complex projects. It is built on top of Spring MVC . I 'll advice u have a good understanding of Spring MVC first before going into it. I have used it and its very cool what you can do with it

Hope i was able to answer your questions if not let me know
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by sbucareer(f): 4:34pm On Sep 15, 2006

Candylips, thanks for your very useful insight into Spring. I am still going through the book(s) you recommended, already I have started falling in love with spring, although I have not concluded why I should use Spring in my J2EE project but I can see it is interesting.

Like many other layered Java/J2EE application framework, I can begin to see the less use of numerous properties files and helper classes littering the codebase.

Maybe I am an EJB die-hard believer, I still like my EJB, with all the Facade, Remote and Local object implementation.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 4:58pm On Sep 15, 2006
Yes you can still use your Ejb implementations inside Spring.
But with time you will find out that you really would not need EJB's except for the most very complex projects
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 3:08am On Sep 18, 2006
@ candylips

Thanks for your candid guidance. but I think some of the point you raised about EJB 3.0,
is quite debatable, EJB 3.0 is backward compartable, you can deploy you EJB 2.1 applications in EJB 3.0 servers.
Take a look at the specification, nothing about persistence was mentioned in it, it was the same old
Entity Bean. SUN created a different specification for persistence. Also, the new persistence api is not tied
to Java EE, it can be used in other java se applications including web service.

Here is the link for persistence specification https://sdlc1a.sun.com/ECom/EComActionServlet;jsessionid=198C719191DA6A6569A05A3322C79AAE#


@subcareer

Thanks for your comments about my font size, hope it's better now. Please, do you have the
ebook version of the book, you are using for the Spring Framework ?. In my last post, I wanted to know the
book you are using for EJB 3.0, because I am using Mastering EJB 4th Edition, nice book. I could send you
the ebook copy, if you are interested
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by sbucareer(f): 3:37am On Sep 18, 2006

mimoh_mi, I will send the the ecopy of the spring book that I using later on today. I left it in the office. I hardly take books and any job home else my wifes will kill me.

I am still reading the spring, I think I am on chapter five. I am evaluating it with BEA web application server.

I am still getting use to BEA environment. I will give you my honest feedback soonest.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by sbucareer(f): 3:48am On Sep 18, 2006

mimoh_mi, give me your email or IM I will send you some interesting J2EE ebooks that I have
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 10:51am On Sep 18, 2006
@mimoh_mi

I never said Ejb 3.0 was not compatible with Ejb 2. What i said was Ejb3's is that for you to enjoy the best features of EJB 3 i.e annotations. you need Java 1.5 and therefore if you do not have the luxury of using Java 1.5 in a project you run into problems and becuase of this a lot of people are still ignoring Ejb 3.

However Ejb2 used a lot of xml for configuration while ejb 3 uses annontations. while they are compaitble. migrating an ejb2 app to an ejb 3 app would take considerable effort because you need to do a lot of refactoring . I dont know maybe there are tools out there that can do the migration easily but if you would have to do it manually would definately be a pain sad

@sbucareer

what areas of j2ee do u ve books on. i wouldnt mind having a look as well smiley

(1) (2) (Reply)

Effective Way To Learn Java Programming / Is Nairaland A Threat To Nairaland? / Programmers, Please Recommend A Good Laptop For Me.

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 126
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.