-
1. Re: getRestrictions() in Seam 2.1
dan.j.allen Oct 23, 2008 5:01 PM (in response to twhitehead.twhiteheadjm.hotmail.com)You should be setting your restriction strings in the constructor of the class (or the @Create method). Generally it is bad practice to perform logic in the getter method, which is why I changed the templates for seam-gen.
-
2. Re: getRestrictions() in Seam 2.1
dan.j.allen Oct 23, 2008 5:02 PM (in response to twhitehead.twhiteheadjm.hotmail.com)
And incidentally, why cant I use the version number 2.1.0.GA as a tag for the thread? Surely it would make sense if your issue is specific to a version?Start a new thread for this question and perhaps even consider filing a JIRA report if you get positive feedback.
-
3. Re: getRestrictions() in Seam 2.1
twhitehead.twhiteheadjm.hotmail.com Oct 23, 2008 10:50 PM (in response to twhitehead.twhiteheadjm.hotmail.com)Thank you for the advice. I created a project with seam-gen to see how it does it and now my class is like this:
@Name("incomeList") public class IncomeList extends EntityQuery<Income> { private static final String[] RESTRICTIONS = { "income.aircraft.site.oid=#{currentSite.oid}", "income.aircraft.oid=#{current.aircraftOid}", "income.incomeType.oid=#{current.incomeTypeOid}", }; private static final String EJBQL = "select income from Income income"; public IncomeList() { setEjbql(EJBQL); setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS)); setMaxResults(25); } }
But it still throws the same null pointer exception.
This is code that works in 2.0.3.CR1I dont think any of the examples that ship with seam extend EntityQuery, so it is necessary to use seam-gen to get an idea of how it should be used.
The project I created with seam-gen does work. -
4. Re: getRestrictions() in Seam 2.1
loebb01 Oct 30, 2008 6:10 PM (in response to twhitehead.twhiteheadjm.hotmail.com)Hi Dan,
since the @Create annotation cannot be used in EntityQueries:
Which is the recommeded way creating restrictions using injected components?
At the time the constructor is called, all injections are null.
Thanks, Daniel
-
5. Re: getRestrictions() in Seam 2.1
dan.j.allen Nov 5, 2008 8:48 AM (in response to twhitehead.twhiteheadjm.hotmail.com)What makes you think that you cannot use @Create for an EntityQuery? Any Seam component can take advantage of @Create.
-
6. Re: getRestrictions() in Seam 2.1
loebb01 Nov 7, 2008 9:06 AM (in response to twhitehead.twhiteheadjm.hotmail.com)Hi Dan,
since the @Create annotation is already used in org.jboss.seam.framework.Query.validate(), the server tells the following on deployment:
java.lang.IllegalStateException: component has two @Create methods: <component name>
So, from my point of view, the only way is to overwrite the validate() method. But that does not rreally makes sense for me.
Do you see any alternatives?
Bye, Daniel
-
7. Re: getRestrictions() in Seam 2.1
accless Nov 7, 2008 2:43 PM (in response to twhitehead.twhiteheadjm.hotmail.com)
Dan Allen wrote on Oct 23, 2008 17:02:
And incidentally, why cant I use the version number 2.1.0.GA as a tag for the thread? Surely it would make sense if your issue is specific to a version?
Start a new thread for this question and perhaps even consider filing a JIRA report if you get positive feedback.The @Create Annotation is not introduced in Seam 2.1, it already exists in Seam 2.0.
The validation against the availability of a set ejb-String at creation time of the component, does not make much sense to me... My work around was to copy the src-code of EntityQuery and Query, in order to be able to modify both of them.
The classes I create are subclassed from my modified EntityQuery and Query Object. This gives me more flexibility and freedom in modifying restrictions and validation which are set by default when u use these classes
greetings
-
8. Re: getRestrictions() in Seam 2.1
joblini Nov 7, 2008 5:49 PM (in response to twhitehead.twhiteheadjm.hotmail.com)It would be helpful to include this information regarding setRestrictionExpressionStrings in the migration21.txt file.