-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Where do i write business logic?
PostPosted: Fri Aug 17, 2007 1:21 pm 
Newbie

Joined: Fri Aug 17, 2007 10:06 am
Posts: 11
Hi, I am new to java and newer to hibernate. I am using exadel studio to generate some classes from database and it creates the folowing files to each class:

person.java
personDAO.java
persaoDAOImpl.java

Where do I write the business logic, so that I can acess other objects and have no problem with sessions.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 17, 2007 1:35 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
simple answer. persoaDAOIMPL.java

real answer. read up on the subject

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 17, 2007 1:58 pm 
Newbie

Joined: Fri Aug 17, 2007 10:06 am
Posts: 11
I really donĀ“t understand your point.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 17, 2007 2:08 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
I answered your question. But, it's a pretty deep question that has quite a few different implementations. And the right implementation for you is best made by your decision after you read up on some hibernate practices and do some examples.

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 17, 2007 2:29 pm 
Newbie

Joined: Fri Aug 17, 2007 10:06 am
Posts: 11
Ok, I readed some articles and each one has its own way to do this.
In my (dummy) opnion, I think that the person.java is the best way to put all business logic.

Looking at this point of view, I need to access the Session object from every class. To do this I think to create a super DAO class with a session instance.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 12:49 am 
Newbie

Joined: Wed Aug 08, 2007 10:11 pm
Posts: 3
you can't put your business logic in DAO , but you can put in new class using business delegate pattern, you can read how to utilize that pattern by googling.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 8:22 am 
Newbie

Joined: Fri Aug 17, 2007 10:06 am
Posts: 11
This sound like a weak OOP implementation.

Any one look problems using this aproach?

personDAO.java (interface to access data)
personDAOImpl.java (implementation of access data)
person.java (gets/sets of columns and all business logic related with this object).

Thinking this way, I will have methods like:

myPerson.buy(product)
myPerson.cancel

instead of:
myShop.buy(myPerson, product)
myShop.cancel(myPerson)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.