aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes HIbernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "HIbernate" Watch "HIbernate" New topic
Author

HIbernate

Nancy O'Connell
Greenhorn

Joined: Jan 27, 2004
Posts: 16
Is Hibernate something you would use to replace an architecture like Struts?
In other words, if we have a struts application, could we re-write it using Hibernate? And would it still run under Websphere or WebLogic?

Does the book provide real world examples of how applications can be made better, faster and lighter?
Shed Hollaway
Greenhorn

Joined: Aug 11, 2003
Posts: 9
>>Is Hibernate something you would use to replace an architecture like >>Struts?
Hibernate is not a replacement for Struts but an O/R presistence layer that can be used to enhances an architecture.

>>In other words, if we have a struts application, could we re-write it >>using Hibernate? And would it still run under Websphere or WebLogic?

Also, Struts application that are wrote to use Hibernate will run Websphere or Weblogic.
anand malu
Greenhorn

Joined: Oct 12, 2004
Posts: 1
Think of using hibernate as a layer between your application and database.
Using hibernate is independent of which appl. server you use.
Sean Walker
Ranch Hand

Joined: Feb 04, 2004
Posts: 64
Not sure if I'm over-stepping your intend question - but there are other open source frameworks that fill the same niche as Struts. For example WebWork, Tapestry and Spring. See:

https://webwork.dev.java.net/
http://jakarta.apache.org/tapestry/
http://www.springframework.org/


Sean Walker<br />PMP, SCEA, SCWCD, SCJP
Prakash Dwivedi
Ranch Hand

Joined: Sep 28, 2002
Posts: 452
Originally posted by anand malu:
Think of using hibernate as a layer between your application and database.
Using hibernate is independent of which appl. server you use.


So hibernate is an alternative to Entity Bean, right?


Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Is Hibernate something you would use to replace an architecture like Struts?


No , never.

Hibernate is OR-mapping for persistent data susch as RDBMS. (Data Layer)

Struts Framework is web framework which it's support MVC. (Web Layer)

you can integrated both together.


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
So hibernate is an alternative to Entity Bean, right?


Yes, all right.

You can replace Entity bean with hibernate.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
would it still run under Websphere or WebLogic?


Yes, you can install/run hibernate and struts on all WEb/Application SErver are supported java technologies.
Arun Prasath
Ranch Hand

Joined: Sep 17, 2003
Posts: 192
In an existing application with lots of session beans and entity beans, replacing existing entity beans with Hibernate offers any improvement? if so what are they?


SCJP 1.4, SCDJWS , SCJA<br />I can do ALL things through CHRIST who strengthens me.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
If you want to change from ejb to hibernate, you MUST got risk to development.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by Arun Prasath:
In an existing application with lots of session beans and entity beans, replacing existing entity beans with Hibernate offers any improvement? if so what are they?


Hibernate domain objects are POJO without any complicated life cycle methods that Entity beans have.


Groovy
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Hibernate also supports Inheritance which is missing in entity beans.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
EJB Inheritant
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by somkiat puisungnoen:
EJB Inheritant


I have read that before. Inheritance in Hibernate is much easier than what you could possibly do using entity beans
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Yes, EJB inheritance is difficult more than hibernate.
Prakash Dwivedi
Ranch Hand

Joined: Sep 28, 2002
Posts: 452
Is there any particular reason why developers should consider using hibernate rather than Entity Beans. Entity Beans are tested component, provided by Sun.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by Prakash Dwivedi:
Is there any particular reason why developers should consider using hibernate rather than Entity Beans. Entity Beans are tested component, provided by Sun.


Hibernate is a light weight framework where the domain objects are POJO rather than implementing EntityBean interface with bunch of lifecycle method. there are more reasons, Checkout the Hibernate introduction pdf from www.hibernate.org.

EJB 3.0 is based on Hibernate idea. It makes entity bean class a POJO.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Entity Beans are tested component


No, Entity Bean is Business component that it's provides by SUN.

Entity Bean is used in world business application, But Entity bean /SEssion bean (EJB) are have overhead very much because EJB container provided several task such as Transaction, Security managemend , Life Cycle .. etc .
Ashok Mash
Ranch Hand

Joined: Oct 13, 2000
Posts: 1936
Hibernate looks like its getting more and more popular, however, is it matured enough to replace something like EJBs altogether? Or can they be used together at any stage?

Also, is there an equivalent feature in Hibernate to compare against EJB roles and security?

Thanks,

Ashok.


[ flickr ]
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Hibernate VS EJB 1

Hibernate VS EJB 2
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by Ashok Mash:
Hibernate looks like its getting more and more popular, however, is it matured enough to replace something like EJBs altogether? Or can they be used together at any stage?

Also, is there an equivalent feature in Hibernate to compare against EJB roles and security?

Thanks,

Ashok.


Hibernate is an alternative to entity beans and not EJB itself. Many applications use session beans with Hibernate.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by somkiat puisungnoen:


No, Entity Bean is Business component that it's provides by SUN.

Entity Bean is used in world business application, But Entity bean /SEssion bean (EJB) are have overhead very much because EJB container provided several task such as Transaction, Security managemend , Life Cycle .. etc .


I think Prakash meant that Entity beans have been used in many applications so is a tested component. The reality is Hibernate is popular because of shortcoming in entity beans. EJB 3.0 should over come those.
Patricia LaRue
Greenhorn

Joined: May 03, 2004
Posts: 4
Entity Bean is used in world business application, But Entity bean /SEssion bean (EJB) are have overhead very much because EJB container provided several task such as Transaction, Security managemend , Life Cycle .. etc .


Does Hibernate support Transactions and Security Management? Because these can be very important in an Enterprise Application.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

It does if you use it in a container, or in conjunction with seperate security and TransactionManager layers. Hibernate is just an ORM layer, which is one of its main benefits.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jaffery Rab
Ranch Hand

Joined: Jan 18, 2002
Posts: 36
Hi folks,
If you don't want to use ejb container for data persistance...check out Sun JDO more stable and proven technology than Hibernate.
B Tate
Author
Greenhorn

Joined: Aug 14, 2003
Posts: 12
Greetings. The JavaRanch book for the day is Better, Faster, Lighter Java. It's got a pretty good overview of Hibernate.

When you build applications, often you want to deal with your data as if it were stored in objects, instead of rows and columns like JDBC. This general strategy is called Transparent Persistence.

I like Hibernate because it's query language is closer to SQL than most other persistence frameworks. That makes it easier to learn, and also made it easier to build. JDO also has some excellent products, like Kodo JDO, and Versant's JDO implementation (used to be JDO Genie.)

The EJB2 model is pretty much supported for compatibility only from EJB3.0 forward. In fact, we're not quite sure what the persistence model will be, but it's likely to be closer to Hibernate or JDO (actually, the JDO expert group and the EJB expert group which has Gavin King, the Hibernate inventor), are working together to form the persistence standard for EJB.

I hope this helps.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Does Hibernate support Transactions and Security Management?


Bibernate support both.

Transaction in hibernate, you can use JTA(Java TRansaction API).

Security in hibernate, you can use JASS.

REference Website
http://www.hibernate.org/139.html
http://www.hibernate.org/164.html
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

check out Sun JDO more stable and proven technology than Hibernate.


Couls you please explain how?
Kalpesh Soni
Ranch Hand

Joined: Jan 02, 2001
Posts: 312
=== courtesy sanjib ghosh from my company tavant ===

EJB3.0 early draft is out for review: http://java.sun.com/products/ejb/docs.html
Those who hate EJB must take a look at this. The fat is gone. It has become simple POJI/POJO model. Add a few annotations to it and you get an EJB. Seriously, no more Home interface, no more DD hell. No more JNDI reference in your code. Container services are provided using dependency injection ( to learn more read : http://www.martinfowler.com/articles/injection.html ) . Bye Bye Service Locator pattern. You can very easily test it outside the container. Don't you just love it. Wait, there is more ...


The whole entity bean model is changed completely. It is almost identical(even syntax wise) to Hibernate 2.x. Take a look at what future entity bean would look :
http://hibernate.org/~gavin/ebejb3.pdf Suddenly, DTO becomes an anti-pattern!

However, there are some issues with java persistence model in the community. There is some big ego fight going on between EJB EG and JDO EG for last couple of months. It creates even more confusion as Entity Bean 3.0 model is so much similar to JD0 2.0 model. Geir & Jeremy state the whole confusion nicely and suggested a solution: http://blogs.codehaus.org/people/geir/archives/000758_persisting_problems.html
Let's see if these two EG converge and come out with one solution for persistence. Either way, we get a TRANSPARENT persistence model.





In short, hibernate is just great


Test 094, IBM WID 6.0 cert
SCJP 1.2
SCBCD 1.3 Beta
SCWCD 1.4 Beta
SCMAD Beta
SCDJWS Beta

KS
Kalpesh Soni
Ranch Hand

Joined: Jan 02, 2001
Posts: 312
more

follow links on this page
http://www.coderanch.com/t/215003/ORM/java/Hibernate-JDO





KSEJB3.0 and JDO2.0
[ October 14, 2004: Message edited by: Kalpesh Soni ]
 
Consider Paul's rocket mass heater.
 
subject: HIbernate