jQuery in Action, 3rd edition
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
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Seam with DAO" Watch "Seam with DAO" New topic

Seam with DAO

fatih soylemez

Joined: May 12, 2009
Posts: 9
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Nov 08, 2003
Posts: 3479

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
jQuery in Action, 3rd edition