Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Seam with DAO

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.


 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use code tags only for code.
 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
And then the flying monkeys attacked. My only defense was this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!