File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Weld - passing parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "Weld - passing parameters" Watch "Weld - passing parameters" New topic
Author

Weld - passing parameters

Grzegorz Novvak
Greenhorn

Joined: Nov 12, 2009
Posts: 12
Hi, I have a method which gets an entity from db. It's a standart method:


I'd like to use the @Produces annotation, something like this:



and in a JSF managef bean



but i don't know how to pass the id to the method. Is it possible? How to do this?

Thanks for any help.
Raf Szczypiorski
Ranch Hand

Joined: Aug 21, 2008
Posts: 383
Hi. The int id is an injection point in a producer method, so you need to create a bean / producer that is able to produce values of type int / Integer (these are treated identically). You take the id from somewhere, so once you get it, you could put it to a static (yuck) variable somewhere (directly or calling a method, both suck) to a Bean that also has a producer method that returns this variable. To avoid statics you could also inject the Bean that has the producer method for the int, and call some arbitrary method on it to set the value to the id. It would probably be session / request scoped I suppose. Something along these lines will work.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Weld - passing parameters
 
Similar Threads
Override Superclass annotation
Use of Custom Annotations
how to inject a resource using custom annotation
missing property FetchType.EAGER in entityManger.find ?
get generated key