File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HIbernate

 
Nancy O'Connell
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>>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
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So hibernate is an alternative to Entity Bean, right?


Yes, all right.

You can replace Entity bean with hibernate.
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 192
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to change from ejb to hibernate, you MUST got risk to development.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate also supports Inheritance which is missing in entity beans.
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB Inheritant
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1312
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, EJB inheritance is difficult more than hibernate.
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1312
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1936
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate VS EJB 1

Hibernate VS EJB 2
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jaffery Rab
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1312
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check out Sun JDO more stable and proven technology than Hibernate.


Couls you please explain how?
 
Kalpesh Soni
Ranch Hand
Posts: 312
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
=== 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
 
Kalpesh Soni
Ranch Hand
Posts: 312
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic