[JBoss Seam] - Re: Injection woes
by ptmain
It would get the job done, but my goal also was to reduce it to one annotation, since @Singleton really says it all. :-)
BTW, I had a terrible time with the following pattern today when referencing a simple java object that doesn't have a Seam @Name tag:
@In (create = true)
| @Out (scope = SESSION)
| private DocumentManager docMgr;
I'm not including the DocumentManager code, as it's just a java class with a simple public constructor.
I kept getting the error where it was complaining about the docMgr attribute being required but not being initialized (I don't have the log file handy right now). Anyway, the only way I could make it work was to add an @Name tag to the DocumentManager class. This was even more frustrating because directly beneath those lines was the following block of code:
@In (create = true)
| @Out (scope = SESSION)
| private QCCache qcCache;
And this worked fine without any changes! (And QCCache has no @Name annotation either). Very odd that it worked for one case and not another...
I was sort of assuming that Seam would be following the "use an intuitive default" approach and would use the variable's name as the context key, without having to instrument the referenced object. After all, I might want to reference a java.util.Date object, and I can't add a @Name annotaton to that without subclassing it.
Any ideas? Am I just abusing the bijection feature?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965403#3965403
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965403
19 years, 9 months
[JBoss Seam] - Re: Praise for Seam
by SmokingAPipe
By the way, here's my next feature request for Seam:
I love that I can use annotations for so many things now, including form input validation. That's great!
The one thing I find I need the most though is automatic form generation. The reason is: The current business cycle for web development is people want a demo / prototype FAST. They want to see something working right away. Some annotations that would let me quickly and automatically generate forms from objects would be great. They don't need to look pretty, but they need to function.
That's my wish list.
Oh, and also better debugging capabilities. It is crazy-difficult to track things down when the app isn't working right and the bug is some minor XML thing. For example, I didn't have a seam.properties at first. It just needs to be there as an empty file. If it isn't there there should be a simple message in the exception, something like, "you must have a seam.properties file to use Seam, and I couldn't find it in the classloader."
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965393#3965393
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965393
19 years, 9 months
[JBoss Seam] - How to deal with a list
by SmokingAPipe
I'm setting up an application that has an object called Person. Every Person has an Address. But it's more complicated than that. For various legal and accounting reasons, we need to keep track of every Address that Person has ever had. So I set it up like this:
| @Entity public class Person {
|
| private List<Address> addresses;
|
| public List<Address> getAddresses() { ... }
| public void setAddresses(List<Address> list) { .... }
|
| // and to make it easy to get the current address:
| public void setCurrentAddress(Address address) {
| if(addressess == null) addresses = new LinkedList<Addresses>();
| addresses.add(address);
| }
|
| public Address getAddress() {
| // return the last element in the addresses array
| }
| }
|
Pretty straight-forward, right? Oh, and I have set Cascade to ALL for these lists, so that is taken care of.
How do I handle this within Seam? If I don't put @Transient on getAddress(), then it creates a bytea field in the DB to store the address, which is not what I want. If I do market it as transient, nothing gets stored.
There must be some simple way to handle this, right?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965387#3965387
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965387
19 years, 9 months