This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes Seam with DAO Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Seam with DAO" Watch "Seam with DAO" New topic
Author

Seam with DAO

fatih soylemez
Greenhorn

Joined: May 12, 2009
Posts: 9
Hello,
I have a few questions that i hope you can answer.
I am developing a project with Seam JPA and Tomcat(i dont use ejb3).It is not a simple application that i will only use CRUD operations on database.
And i like to use DAO pattern which makes code more readable,reusable etc.

My first questions are,

is it not good/useless to use service and dao layer with Seam? (Service,ServiceImpl,DAO,HibernateDAO)

if i use DAOs , do i have to use EntityManager inside them?What happens if i use EntityManager what happens if i dont?

how can i inject Services/DAOs into the session? i was using Service,Repository annotations to declare them and Autowired
annotations to get them from the session while using Spring.is there any similar way?


For example i have the following code,

but when i call MenuCategoryDAO from an Action class with @In annotation,it comes null.
Do i have to make any other declarations in the components.xml or somewhere else?


Can someone give me example of implementing DAOs without using EntityManager and using them
into Action classes.


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please use code tags only for code.
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

Seam doesn't hold your hands, if you want to create DAOs then do, no harm is done.
I'm not Seam developer but AFAIR, you can inject EntityManager or Hibernate Session.
About injecting objects into scopes, did you tried @Out ?
Bijection is a fundamental corner stone in Seam.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Seam with DAO
 
Similar Threads
Some thoughts about abstracting everything from everything
JPA with JSF and Concurrency
Generic DAO using Spring
DOA as session bean ?
Who didn't use SLSB for DAO?