Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,195,365 members, 7,957,983 topics. Date: Wednesday, 25 September 2024 at 06:45 AM

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

Nairaland Forum / Science/Technology / Programming / Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 (4445 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)

Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 1:08am On Sep 19, 2006
@subcareer


Hey man, will really appreciate that, my mail add is mimoh_mi@yahoo.com


@candylips


The fact is you guys are cool, I hope we can keep this tempo up. I am really doing a lot
of hands on in multiple areas right now. Especially in areas like Java EE, Frameworks
and xml. Come to think of it how much of xml do one have to know as a Java Developer ?
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 12:41pm On Sep 19, 2006
Yea man. i am availabe for stimulating j2ee discussions. expecially in the use of frameworks and patterns. wink
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 11:42pm On Sep 22, 2006
@subcareer

Hey, thanks for the ebooks, very nice books. I have been reading Agile Java Crafting Code with Test-Driven
Development, never thought of doing testing, but very nice approach to programming. Just finished chapter two,
and try to work a solution to the exercise, promise to submit my solutions for your perusal. Once more a big thanks and
have a sweet and error free weekend.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 2:34am On Sep 23, 2006
@subcareer

Finally, here is my solution for exercise two, but i strongly believe that the code can be better,
I will just post as per the requirements



[b]

// PawnTest class

public class PawnTest extends junit.framework.TestCase {

public void testCase() {

String firstPawnColor = "White";
Pawn whitePawn = new Pawn(firstPawnColor);
//String whitePawn = firstPawn.getColor();
assertEquals(firstPawnColor, whitePawn.getColor());

String secondPawnColor = "black";
Pawn blackPawn = new Pawn(secondPawnColor);
assertEquals(secondPawnColor, blackPawn.getColor());

//Pawn noClolor = new Pawn();


}
}

// Pawn class

public class Pawn {

private final static String BLACK_PAWN = "black";
private final static String WHITE_COLOR = "white";
private String color;

public Pawn() {
this.color = WHITE_COLOR;
}

public Pawn(String color){
this.color = color;

}


public String getColor(){

return color;
}

public void setColor(String color){
this.color = color;
}

}

//BoardTest class

import junit.framework.TestCase;
import java.util.*;




public class BoardTest extends TestCase {


private Board board;
private Pawn pawn;

public void setUp(){

pawn = new Pawn();
board = new Board(pawn);


}

public void testCase(){


// Pawn pawn = new Pawn();
//board = new Board();
assertEquals(0,board.getNumberOfPieces());
assertEquals("white",board.getPawnColor());

}

public void testAddPawn(){


pawn = new Pawn("black"wink;
board = new Board(pawn);
board.addPawn(pawn);
assertEquals("black",board.getPawnColor());
assertEquals(1,board.getNumberOfPieces());


Pawn pawn2 = new Pawn("white"wink;
board.addPawn(pawn2);
assertEquals("white", pawn2.getColor());
assertEquals(2, board.getNumberOfPieces());


assertEquals("black",pawn.getColor());
assertEquals("white",pawn2.getColor());

}
}


//Board class
import java.util.*;

public class Board {

//create an ArrayList of pawns to be added to the board
private ArrayList<Pawn> board = new ArrayList<Pawn>();

private Pawn pawn;

//Board constructor, this can be used to add new pawns
public Board(Pawn pawn){
this.pawn = pawn;
}


//public Board() {
// pawn = new Pawn();
//}


public void addPawn(Pawn pawn){
board.add(pawn);
}

public int getNumberOfPieces(){
return board.size();
}

public String getPawnColor(){
return pawn.getColor();
}


}

//AllTest.java

import junit.framework.*;

public class AllTest {

public static TestSuite suite() {
TestSuite suite = new TestSuite();

suite.addTestSuite(PawnTest.class);
suite.addTestSuite(BoardTest.class);

return suite;
}


}
[/b]
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by sbucareer(f): 2:58am On Sep 23, 2006

You are a quick learner. Good you are getting the hang of JUnit. That is what I used for all my project. Build and test at the same time, hence XP (eXtrem Programming)

I will review your project later on today, just got back from work, feeling sleepy
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 12:36am On Sep 24, 2006
@subcareer

Thanks for the encouragement, these are my final codes after refactoring

[b]
// PawnTest class
package pieces;

public class PawnTest extends junit.framework.TestCase {

public void testCase() {

String firstPawnColor = Pawn.WHITE_PAWN;
Pawn whitePawn = new Pawn(firstPawnColor);
assertEquals(firstPawnColor, whitePawn.getColor());

String secondPawnColor = Pawn.BLACK_PAWN;
Pawn blackPawn = new Pawn(secondPawnColor);
assertEquals(secondPawnColor, blackPawn.getColor());

}
}

// Pawn class

package pieces;

public class Pawn {

public final static String BLACK_PAWN = "black";
public final static String WHITE_PAWN = "white";
private String color;


public Pawn(String color){
this.color = color;

}


public String getColor(){

return color;
}

}

//BoardTest class

import junit.framework.TestCase;
import java.util.*;
import pieces.*;

public class BoardTest extends TestCase {


private Board board;


public void setUp(){


board = new Board();


}

public void testCase(){

//Just testing to make sure, I have no pawn on the board
assertEquals(0,board.getNumberOfPieces());


}

public void testAddPawn(){


//create a piece of pawn and add it to the board

Pawn pawn1 = new Pawn(Pawn.BLACK_PAWN);
board.addPawn(pawn1);

//Check numbers of pawns on board
assertEquals(1,board.getNumberOfPieces());

//Test if the pawn is the first pawn added to the board,then test for the colour
assertEquals(pawn1, board.get(0));
assertEquals("black",board.getPawnColor(0));

//same test as for pawn1
Pawn pawn2 = new Pawn(Pawn.WHITE_PAWN);
board.addPawn(pawn2);
assertEquals(2, board.getNumberOfPieces());
assertEquals(pawn2, board.get(1));
assertEquals("white", board.getPawnColor(1));

//Testing with the Pawn getColor() to ensure the colour is as per expected.
assertEquals("black",pawn1.getColor());
assertEquals("white",pawn2.getColor());

}
}

//Board class
import java.util.*;
import pieces.Pawn;



public class Board {

//create an ArrayList of pawns to be added to the board
private List<Pawn> pawns = new ArrayList<Pawn>();


//Board constructor, this can be used to add new pawns
public Board(Pawn pawn){
pawn = new Pawn(Pawn.WHITE_PAWN);
}

public Board(){}


public void addPawn(Pawn pawn){
pawns.add(pawn);
}

public int getNumberOfPieces(){
return pawns.size();
}


public Pawn get(int index){

return pawns.get(index);
}


//Not too comfortable with this method,think there should be a better way
//to handle. Just getting a Pawn object from get(index) and calling it's
//getColor() to get the colour.

public String getPawnColor(int index){
return get(index).getColor();
}


}

[/b]

Hope to hear from you, just started chapter three today. Once more thanks
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 10:02am On Sep 24, 2006
nice to see you guys are into test driven development as well. nice one.

however junit is only good for testing ur business logic ,if you want to test your database layer or web tier. use. DBUNIT - for database testing and Jwebunit or httpunit for web tier testing. these testing frameworks are essentially built on top to junit

have fun
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 4:18am On Oct 03, 2006
@subcareer n candylips

Thanks for the support, had to migrate to ubuntu linux,
took most of my time getting all my java stuff to run on it. Had to look for a way
getting a chm reader for linux. Now am back on track and ready to move on.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by chineduleo(m): 5:39pm On Oct 03, 2006
I must commend you for your enthusiasm.I am highly interested.if only you are willing to teach,i'm willing to learn.The problem here is,i am an experienced VB programmer and i want to make that transition to J2EE.Already started with J2se but i am not too grounded are you guys willing to take me on the whole hog.i'll deeply appreciate it.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 11:40pm On Oct 07, 2006
@chineduleo


Since you are into VB, most OOP concept should be quite clear to you. Also,
just try and go through these links, you should be up and running fast.
Thanks.

https://www.nairaland.com/nigeria/topic-8060.0.html
https://www.nairaland.com/nigeria/topic-6848.0.html
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(m): 3:11am On Oct 09, 2006
@subcareer

Hey, been knocking my head on the wall for sometime
now. I just got stock on exercise 2, number 5. Please how were you able to create the
black and white ranks for the pawns. Was i suppose to use the normal for statement
or for each, to get my ranks. Please will like to see your solution.
Thanks
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by Cappela(m): 11:29pm On Oct 12, 2006
Please, subcareer - could you tell me where I can get good computer books in Lagos or if you buy from Amazon.com, how do you do about the shipping. Please, I will appreciate anybody's good response on this. Thanks in advance.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by williamnow: 1:39am On Oct 13, 2006
THANKS FOR THE INFORMATION[/color][flash=200,200][/flash][/b]. cheesy[/b]
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by bioye(m): 6:58am On Oct 18, 2006
EJB, Spring, Hibernate, Test Driven Development, Frameworks, Patterns. Quite Interesting.

If you guys dont mind, I'll share my perspective on Enterprise Java Development. My Java history went from Java SE/ AWT/Swing to Servlets then JSP then MVC then Struts then Webwork until I eventually chose Tapestry as web framework in preference to JSF. On the business logic side, I studied EJB for a short spell intending to use it wholeheartedly until I kept noticing serious criticisms of its design especially on theserverside.com.

Right now, I use Tapestry as web layer, pure java classes for business layer and Hibernate for persistence. Talking ioC/ Dependency injection I use Hivemind and not Spring. Personally, I'm yet to find a solution that cannot be solved using a simple servlet framework. So, my question is: is your use of EJB really justified? Dont you notice that you can do an equal or even better and simpler job by using a web framework with pure java and hibernate? I look forward to your responses.

For unit testing, try testNG, it builds on JUnit but addresses its shortfalls. A lot of gurus already advocate it. Cheers.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 3:10pm On Oct 18, 2006
ok bioye i have gat a couple of months Tapestry experience behind my belt and i think its really awesome.
I have used Struts and Spring MVC extensively you just can't fault the joy you derive when you use Tapestry.
Well i still use Spring for the IOC and use Hivemind only to inject Tapestry services like State and Engine services. While hivemind is good for simple IOC , Spring is more roboust especially when you are working with transaction management , Caching and Aspect Oriented Programming.
AlsoWhat Hivemind doesnt give you which spring does is forcing you to programm to interfaces.


ok so you normally use Tapestry(Pages) - Java classes- Hibernate

Ques: How do you handle Hibernate Lazy Loading Exceptions in your Tapestry pages 
I have heard about the Tapestry DataSqueezer but i havent used it . but if you were using Spring you have access
to the spring open sessionin view filter free of charge  cheesy



i have played around with TestNG and its cute good but i havent get a chance to use it on any project am currently involved in. In most cases Junit is just appropraite but you can also use DBunit for database testing and if you work in a team eviroment whereby your code depends on someone else code you can use Mocks a good framework that does this is JMock
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by sbucareer(f): 2:35am On Oct 19, 2006
biyoe:
On the business logic side, I studied EJB for a short spell intending to use it wholeheartedly until I kept noticing serious criticisms of its design especially on theserverside.com.


I subconsciously believed that EJB was over engineered. Yes it is. First, remember the issues EJB tried to solve. EJB is a container that was designed to manage and synchronize these tasks?

1. Security
2. Thread issues (Hence processes synchronization)
3. Transaction Management (ACID)
4. Database pooling (Less connection to DB for every request, very helpful)
5. Object messages (hence JMS and the issues of design patterns i.e inheritance and all that)
6. A simple framework, hence EJB

Yes, even Sun accepted that EJB was over engineered. The 2.x version of EJB has some problems relating to cross platforms and so many codes involves in writing a simple beans.

Sun introduced EJB 3.x with annotation and injection of class relative to their JNDI directory. The EJB 3.x are now very easy to learn. They are like POJO (Plain Old Java Object) with just annotations. You can run and test them outside EJB container.

Imagine you were writing a bank application or say an ebay application without EJB or .NET, you would have to worry about the securities, database connection and pool manager, threads, transaction manager, if you were using like say three or four different database connected remotely. Unless you work for oracle database Engineer I wonder how you would manage to code you application to take account of 3PC (Three Phase Commit).

You have not even started writing you application logic yet, you are already coding all the necessary container features and security. Incase you do not know 3PC is a mechanism used by database to manage a distributed database or processes where it has a global manager that manages a local managers.

Each manager takes care of it database transaction and return abort ot commit status to the global manager if all return commit the database is committed if one return abort the global manager must decide if to abort or resend a commit signal to the manager that returned abort.

Sometime it is necessary for a global manager to wait for a while it might be network issues, traffic issue or the remote database is rebooted as an engineer you have to make that decision and and hope that your buyers are happy with your decisions

Now, Is EJB good for all project? The answer will determine if you choose EJB, spring, Tapestry Struct or other framework. If you are designing a simple login database why on earth do you need EJB? If you are designing a shoppingcart why do you need EJB.

EJB is a powerful technology and it is resource intensive. You have to consider your project carefully before choosing EJB. Beside a project manager should have produced a project plan including technical and none technical requirements and the scope and mitigating issue in relation to the project success or failure.

You can NEVER compare EJB to all these light framework. People often make this mistake to think that EJB is suited for all projects, well the answer is no it is  not.

EJB addresses serious issues that you can never begin to imagine. What I have say here is just a fraction of what EJB addresses. If you want to know more go to sun website and read EJB Roadmap

EJB is father of all enterprise computing application, even if you look at the job market you will see how much they pay EJB/J2EE guys. Remember that all these other frameworks i.e spring, Tapestry Hibernate etc was designed and developed by J2EE consultant that knew the power of EJB and that many people did not fully understand the purpose of EJB, hence introduced light framework for their simple login application.


Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by sbucareer(f): 3:07am On Oct 19, 2006


Look at this database code

             try{
                           con.setAutoCommit(false);
                           con.prepareStatement("Select id, balance, from account where id='?);
                           con.setInt(1, variable);
                           con.executeQuery();
            }catch(SQLException e){
                          con.rollback();
                          e.printStackTrace();
             }
             con.commit();
            con.close();

         }//End

Look at what you are doing managing the transaction, you have not even put it in a thread safe state and make it synchronized. Every time someone calls this business method it creates a new connection and close it, not every efficient. What about scalability how about ACID, database manager. Remember that mysql is not good for transaction management that is why it is free. They make money by consultation to write this TM (Transaction Managers) for you.

A full fledge TM is Oracle that is why it is very expensive and very good DB.

Haha!!! you think this is hard you have not even start to thinking about securities. You would start to play with Cryptographic API and keys and private key and tokens etc. You would will start to think about the partition of your POJO's i.e interfaces, inheritance how everything connects to each other in relation to its maintenance.

But EJB have solved all these problems for you all you need is to concentrate on you business logic. Hence in EJB 3.x it only has two files compare to three files in 2.x

1. Remote class
2. Bean class
3. and a descriptor xml file that is it. You don't write any silly SQL anymore you use the JNDI and injections and etc. It manages your tread, EJB guaranteed at anytime it is only one process accessing a share resource or data item to avoid update anomalies.

I will accept this where Java has failed or is till working hard to come up with a standard is the web tier framework. I like JSTF and JSF because I know how to used then very well but lots of people have complained that it is hard to learn.
                           
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 8:49pm On Oct 19, 2006
@ sbucareer

You posts is so hard to read with that font wink

The fact about EJB is that a lot of enterprise apps dont really require the full stack of J2EE. That is why the light weight frameworks are more popular in use these days

EJB is most suitable if you want to build a full fledge distributed application . Most apps dont require these except the very complex ones
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by bioye(m): 5:30pm On Oct 20, 2006
@candylips,

Yes, I'm the one from juglagos.  I'm trying out to see if I can remember you but I seem not to have enough clues!  About how I manage Hibernate's lazy loading,  I guess it might be due to a limitation of ognl/tapestry/hibernate integration.  Have you tried Tapernate? for me, I 'manually' load the object in the Page class before accessing it on the Page template.  This is a workaround and I still have to find time to find a proper solution.  If you do let me know.

@sbucareer,

From my little understanding,  J2EE consists of many technologies apart from EJB.  EJB is only used to handle business logic and business model.  This is what I'm replacing POJO for.  The other things you've been talking about are services, which can be managed for me by, say, Spring, Hibernate and the J2EE API's (minus EJB). 

Hence, I don't even need an Application Server.  All I need is a web server like tomcat or jetty.

Services like clustering/load-balancing, transactions/JTA, JMS, JMX, security, JNDI, connection pooling can be used alongside Tomcat, Spring, Hibernate and POJO's and you wont miss EJB at all.  In fact, it does NOT make sense to use EJB unless you are doing distributed objects or declarative security.

My points are justified when you realise that everything in the latest EJB/ J2EE spec were copied verbatim from Spring, Hibernate and Xdoclet - the tools I have been using for years instead of EJB/App Servers.  So, right now there is a more compelling reason not to use the new EJB because they probably will end up copying my open source tools 2 years from now!

if I'm wrong, i'm willing to learn smiley
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 12:12am On Oct 21, 2006
@bioye

Ok Tapernate should do the trick for lazy loading of objects. Checking it out i can see that you can configure open session in vew in the hivemind.xml file. i havent used it though cos i use Tapestry within spring and spring has its own implementaion of this pattern.

Well if you are manually loading your objects i guess you are working with a very simple object model or  you are probably not really utilizing the full power of Hibernate.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by sbucareer(f): 1:53am On Oct 21, 2006

@biyoe

Read this first then come back and finish my post

Let me take you back like 10 years ago when computing began to address enterprise distributed application. The final specification they came up with was CORBA (Common Object Request Broker Architecture)

The concept was the partitioning of object regardless its physical location on the network, whether on a host that runs the system or on another host that hose the JVM. Hence RMI/RPC (Remote Method Invocation) for Java and (Remote Procedural Calls) for C++.  They use these mechanism to communicate with these object, thus forming distributed application.

They never considered lots of issue or may be they did not have time to cover it and left it with developer to do, thus forming myriad task for these poor developers.

The issues they never considered were:

1. Securities
2. Database transaction
3. Thread pooling
4. Messages between objects (Chatter box) cause bandwith problems during system scalability
5. Distributed database
6. Maintenance
8. Persistence

A typical project that today take 3 months to finish back then takes 3 years. This was due to the work developer had to do, writing all the above services that  the application will be deployed in.

Look at example of a simple corba application that is today EJB. You need 7 java files and need a lot of java switches to convert the IDL to java file and the rest. If you look at the code there is no container deployment just like POJO's.

When you finish compiling you will need to take each piece of code to the machine or host it will reside and the Client to all the client machine they would reside.

If you are in a bad luck the application need to connect to some database, you will need to write the 2PC/3PC first to take care of the ACID (Atomic Consistency, Independent and Durability)

After that you would need to write all the SQL statement. Then you would need to worry about the thread states, you do not want someone to be withdrawing money from the ATM and inside the bank at the same time.

Security like authorization and authentication, verification, process validation and objects verification and path access authentication. In the database side you need to take care of Pooling manager, if you don't, your application would look like connecting your application to Microsoft Access database.

Sun came with a solution J2EE, an application server to manage CORBA and EJB container to manage transaction and security etc. God bless them, they got it right just that they were too enthusiastic and over engineered it.

Like I said in my previous thread, EJB is not suitable for all project. It is good for enterprise wide application development.

Bioye, Tomcat is a web server not and an application server. Understand the difference between web server and application server. Both container serves different purpose. Can you write a GUI application and the application can access tomcat server? The answer you are probably looking for is NO. Because it is NOT an application server, it is just a web server, hence it does not use RMI/RCP to communicate to objects it uses HTTP/HTTPS

Although, the same people that introduce all these light framework for the place of EJB has also introduce some EJB container that could be plugin into tomcat, I wonder why?

Tapestry, Spring, Hibernate, Strut, etc are just simple framework for writing light projects not good for enterprise wide application. Remember all these are JUST FRAMEWORK like EJB, just that EJB specify some strong rules because it has taken care of so many features for you and moreso it has lots of plumbing codes. If you can't express yourself in code then you are not an IT guy simple.

Don't morn all the time that EJB has too much coding, yes it has and we all love it because if you do people think you are clever and pay you more money.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by bioye(m): 11:18am On Oct 21, 2006
candylips:

if u remember the guy that used to send code to the list and tried to propose a project thats me. smiley

I'm guessing you are Femi, the guy that did not like UML then. Do you like it now?

candylips:

Well if you are manually loading your objects i guess you are working with a very simple object model or you are probably not really utilizing the full power of Hibernate.

Wont say so. More like I'm forcing the loading of the object from Java code since ognl seems to fumble. Sample code here:


Session session = HibernateUtil.currentSession();
Query query = session.createQuery("from Employer e where e.status = :status "wink;
query.setString("status",ApplicationConstant.APROVAL_PENDING);
List list = query.list();
if(list != null)
{
setEmployers(list);
}



@sbucareer

first, my name is bioye. I know about CORBA and the history.

I know the difference between a web server and an app server. And I agree with you that EJB or use of an App Server is not appropriate for some projects. I was just asking if people are not over-engineering in certain circumstance just like candylips stated. Infact, if it works well for you and you have no complaints, please use it!


I stress - You only need EJB or an App Server when you need distributed components across multiple servers. So, my question is do you need this currently?

I differentiate between needing and using distributed components here. Some people probably use them even when they don't need them.

Now, be careful not to mix up EJB, J2EE and Application Server features here. EJB is just one feature of J2EE. The only reason you need an App Server is if you are using EJB. Every other container service can be gotten from a container like tomcat or common third-party tools.

Further, I address your laundry list of J2EE container services,

1. Persistence - I don't have to use EJB or app server here because I can do everything with Hibernate and Tomcat
2. Security - Actually, a lot of J2EE security is implemented in the servlet container. Role based and declarative security is available in Tomcat, JAAS is available in J2SE. I can apply servlet filters too and you can use Acegi with Spring for even more options. Spring allows declarative security at the method level using annotations.
3. Database Transanctions - You can use the JTA API from Tomcat and Hibernate comes with advanced Transaction management. Spring even does better including declarative transactions.
4. Thread Pooling - Tomcat has this via Apache Commons Pool
5. Messaging - Though, MDBs is the easiest way to implement messaging, it is the least flexible. I can do my messaging in a web app by calling JMS API directly (OpenJMS) and deploying in Tomcat. It gives me the most flexibility too. JavaSpaces is also an option.
6. Distributed Databases - Hibernate supports this via JTA and Transaction Managers. Similar to 3 [/b]above
7. [b] Maintenance
- Not clear here but if you are talking JMX, you can manage components via Tomcat 100%! Also, good OO programming helps.
8. 2pc/ xa - Spring will handle this well along with Hibernate + XA driver. Never heard of 3pc commit tho. . Similar to 3 and 6[/b]above
9. [b]Thick client support
- 3rd party tools like Caucho's Hessian and Burlap or GLUE; and I can use RMI with Tomcat

At least, Juergen Hoeller, one of the guys that wrote Spring would probably know better. Please, read his 3 posts on this discussion at the serverside and come back and comment:
http://www.theserverside.com/news/thread.tss?thread_id=15228#58871

EJB and App Servers are great but for me, the alternatives are easier, safer, more innovative and most important, free!

And one last thing, don't you think it's a little impolite when you use a word like [b]mourn [/b]when referring to my comments?

if I'm wrong, i'm willing to learn wink

1 Like

Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 12:33pm On Oct 21, 2006
@bioye

No thats not me . .

Looking at your code i have a few observations. firstly its not very good if you have your database code mixed with your  controller code. What you should have done is to abstract out the database specific code into a DAO layer, inject the DAO into your Tapestry pages and then call the required method before then setting the page method.

Looking at your code well. it should work if you are just loading the values in a single table . but when you have a foreign key relationship with many tables e.g lets say your employer table has a 1 - many relationship with employee table , and maybe a 1 - 1 relationship with Department table.

When you run that query in your code Hibernate should automatically look for all the related tables and populate your object graph. This normally fails if you have lazy loading setup and u do not have a kind of Open-session-in -view pattern and tells  hibernate to load the next object graph when it is required most of the time at the view-layer.

This is because the Hibernate session with the database would have been closed by then. But i guess this shouldnt be a problem if you use Tapernate. i just had a look at it yesterday and you can set up the OIV pattern in Hivemind.
This is the same logic i use the only difference is that i manage my Hibernate sessions in Spring

@sbucareer

To add to what bioye has said. and to repeat what i have said earlier. EJB is good but using it would limit you to an EJB  way of doing things. EJB is only good for doing a truly distributed application but majority of projects do not really require this .
So why should you  use EJB in a project when you are not building a distributed applicaition that absolutely requires the sending of objects across multiple platforms ,.
Just to let you know,  Spring for example has a whole lot more features out of the box which EJB can nto even dream of.

i think i have said these in my earlier posts but the Dependecy Injection provided by EJB 3.0 is vey basic and crap compared to what you get  with Spring.

Also, To do EJB 3.0 you need Java 5.0 and unforntuately it is not every body that has the luxury of Java 5.0 in the production environment. However Spring is compatible with 5.0 and earlier versions.

Based on these two facts alone a lot of developers would definately go for something else other that EJB 3.0

Also for your information the fact that you use EJB doesnt mean you will earn more money. I have been in the UK job market for a while now and worked on a lot of contract Jobs with many companies and i can tell you with absolute fact that most Organizations  dont really care less about EJB.

Even Investment banks that create real-time distribtued trading software use a combination of C++ using Extensive CORBA with Just pure core java. Spring is also used extensively to help structure application code.

always try to get your facts right before you make comments please

1 Like

Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by bioye(m): 7:24am On Oct 23, 2006
@Candylips,


Looking at your code i have a few observations. firstly its not very good if you have your database code mixed with your controller code. What you should have done is to abstract out the database specific code into a DAO layer, inject the DAO into your Tapestry pages and then call the required method before then setting the page method.

I agree with you that DAO's are neater. But you really derive the most value from them when you are on very large projects and you do a lot of maintenance. Following my KISS principles, I would only refactor during maintenance when modularity will ease headaches. However, don't worry, I'll soon move totally to the DAO approach. Meanwhile, for curiosity's sake, can you post an example of how you accessed an object graph from a tapestry page class via a DAO?


Looking at your code well. it should work if you are just loading the values in a single table.

Like I told you, it's just a workaround. I actually have relationships that span graphs of objects in my code. I'm not even sure if it works so well. Even when the tapestry page fails to load the object, a refresh solves the problem. However, if you get a good solution to the problem, please let me have it. I must agree with you that some of my code needs refactoring though. I'm guilty of that and there is a reason why it's so - a steep deadline!

candylips:

@bioye

Yea thats me. But i don't think i ever gave the impression that i didnt like UML. Basically you guys never gave the project a chance so it died a natural death.

Common. I don't think you should blame 'we guys'. I posted a UML model of the HR solution and you outrightly disagreed with my approach saying we should go straight to code. I responded that you should post some code to get us started since I couldnt figure how we could collaborate without a proper design to refer to. I But you never posted any code! We let you take the lead but you dissappointed us. And I couldn't just continue because you seriously disagreed with my approach.

Anyways, that's in the past and no hard feelings. We can forget about all that now.
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 7:57am On Oct 23, 2006
bioye:

@Candylips,

I agree with you that DAO's are neater. But you really derive the most value from them when you are on very large projects and you do a lot of maintenance. Following my KISS principles, I would only refactor during maintenance when modularity will ease headaches. However, don't worry, I'll soon move totally to the DAO approach. Meanwhile, for curiosity's sake, can you post an example of how you accessed an object graph from a tapestry page class via a DAO?

Well thats easy, you need to define your DAO in Hivemind or Spring and if you want to access the object in your Tapestry page you add something like this in the Page specification.

<inject property="employeeDAO" type="spring" object="employeeDAO"/>

your page class will have

public abstract IEmployeeDAO getEmployeeDAO();

or if you are using annotations

@InjectObject("employeeDAO"wink
public abstract IEmployeeDAO getEmployeeDAO();

Well my example uses spring i guess if you are configuring your DAO in Hivemind the type attibute should be object instead of spring

Thats it ! you can now access your DAO methods in your Pages .


bioye:

Like I told you, it's just a workaround. I actually have relationships that span graphs of objects in my code. I'm not even sure if it works so well. Even when the tapestry page fails to load the object, a refresh solves the problem. However, if you get a good solution to the problem, please let me have it. I must agree with you that some of my code needs refactoring though. I'm guilty of that and there is a reason why it's so - a steep deadline!


Yea you would be better of refactoring you database logic into a DAO layer but a steep deadline is not an excuse  smiley
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by candylips(m): 3:47pm On Nov 15, 2009
bump
Re: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by kodewrita(m): 4:13pm On Dec 28, 2012
Bump

(1) (2) (Reply)

How To Convert A 20-digit Numeric Value From Base10 To Base36 In C# / The New Germany Opportunity Card? / Open Source Banking Application?

(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. 121
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.