[EJB 3.0] - QuerySyntaxException
by lafr
On the way migrating a EJB 2.1 App to EJB 3.0 I got a problem with an EJB-QL query:
SELECT OBJECT(k)
FROM MbiFesta AS k, IN( k.mbiFekvw ) AS v
WHERE k.tstNr = ?1 AND k.varId = ?2
AND v.verwTabelle = 1 AND v.afCompNr = ?3 AND v.afLfdNr = ?4 AND v.afPosNr = ?5
As a result I get:
javax.ejb.EJBException: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: v near lin
e 1, column 80 [SELECT k FROM biz.mbisoftware.fn.ejb.entity.MbiFesta AS k, IN( k.mbiFekvw ) AS v WHERE k.tstNr = ?1 AND k.varId = ?2
AND v.verwTabelle = 1 AND v.afCompNr = ?3 AND v.afLfdNr = ?4 AND v.afPosNr = ?5]
Why is this not legal?
I also tried JOIN instead of IN, but got a similar exception: (unexpected token JOIN):
FROM MbiFesta AS k, JOIN k.mbiFekvw AS v
After spending much time to test different versions the following version works:
SELECT DISTINCT k
FROM MbiFesta AS k, MbiFekvw AS v
WHERE k.festaSerial = v.festaSerial
AND k.tstNr = ?1 AND k.varId = ?2
AND v.verwTabelle = 1 AND v.afCompNr = ?3 AND v.afLfdNr = ?4 AND v.afPosNr = ?5
But I'd like to understand why before searching and modifying other queries.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085287#4085287
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085287
18 years, 9 months
[JBoss Seam] - Getting proper conversation id after ending nested conversat
by dustismo
Hello,
I have a couple of servlets that I need to explicitly pass in the cid param to. I just noticed that the cid is incorrect if a nested conversation was just ended. Params in the url show cid=XX and parentConversationId=XX.. Obviously the cid is incorrect because the conversation is maintained until after the redirect (I could use endBeforeRedirect but I need the messaging).
So the question is how can I get the correct cid as a parameter for my servlet?
The following method does the trick, but it terribly stupid..
| public String getCid() {
| FacesContext context = FacesContext.getCurrentInstance();
| HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
| String id = Conversation.instance().getId();
| if (Conversation.instance().isNested()) {
| String parentId = request.getParameter("parentConversationId");
| if (parentId != null)
| id = Conversation.instance().getParentId();
| String convProp = request.getParameter("conversationPropagation");
| if (convProp != null && convProp.equals("end"))
| id = Conversation.instance().getParentId();
| }
| return id;
| }
|
|
Is there an improved way to do this? (I am using seam 1.3a so maybe there is something in 2.0?)
thanks for any help,
Dustin
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085286#4085286
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085286
18 years, 9 months
[JBoss Portal] - Newbie question - Customizing presentation based on user pro
by goks@jboss
My environment:
JBoss Portal 2.6
Database Vendor and Version : Oracle 10g
OS Platform : windows XP
My requirement is as follows:
I am new to portal technology as such and JBoss portal in particular.
I want to create a company intranet portal which is customizable based on the user login. Each user belongs to a different department within the company and lets say there are two departments in the firm. When user John belonging to the Legal department logs in, I want him to see data from the Legal applications and when user David from the Travel department logs in, I want to show him application data from applications related to travel. So this information is driven by data stored about the user in the database much earlier.
Question is: I can think of identifing portlets based on the user-profile, but how do I tell Jboss portal about how to arrive at a layout - because based on the no. of applications relevant to the user (identified at runtime) the layout might be for 2 portlets or 4 portlets. What portal API would I use for getting this customization to work.
Since this is a common requirement, I am sure its supported by JBoss portal and many of you might have already implemented this feature.
I would appreciate any help.
Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085277#4085277
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085277
18 years, 9 months
[JBoss Seam] - Re: Wannabe-Example needs help growing up
by pete.muir@jboss.org
"stephen.friedrich" wrote : (Why can't I attach files here?)
Soon now we shall be moving to a new forum (I can't wait :)
anonymous wrote : * Is it ok to "manually" add a newly created entity to the entity query's result list like this (in EmployeeHome):
|
| | public String persist() {
| | String outcome = super.persist();
| | employees.getResultList().add(getInstance());
| | return outcome;
| | }
| |
It's a bit strange ;) In Seam2 we have org.jboss.seam.afterTransactionSuccess.Employee (assmuming the entity you EmployeeHome is named Employee) - so you can observe this event and when it occurs you can call employees.refresh() - this is the nice way to do it.
Does doing a flush and then a employees.refresh() not work in 1.2.1?
anonymous wrote : * At first after deleting an employee the employee's details were still shown in the detail form (but editing/resubmitting the form caused an exception of course). I tried to get around this by overriding the remove method in EmployeeHome:
|
| | public String remove() {
| | String outcome = super.remove();
| | setId(null);
| | return outcome;
| | }
| |
| After that the detail form was indeed empty after deleting an employee.
| Still when you delete an employee, then fill in data in the detail form (without first selecting another employee or clicking on "Create New Employee) and click on "Create" it still crashes with an exception. Any idea?
Current CVS gives you a clearInstance() method - it's
| public void clearInstance()
| {
| setInstance(null);
| setId(null);
| }
try that and get rid of it when you upgrade.
anonymous wrote : * Why do I need to add a newly created employee to the list myself, but a deleted employee is removed from the list automatically?
Probably to do with when the list refreshes (the EntityQuery is request scoped).
anonymous wrote : * Currently it seems that the whole list of employees is reloaded from DB each time I select another employee in the list (by clicking the edit button).
Yup, the query is request scoped ;) You can make it Conversation scoped but then you have to manually manage refreshs (easier when you have the events discussed above).
anonymous wrote : How can I achieve this behaviour:
| - The list should only be reloaded when selecting the "area", i.e. when clicking on the "Employees" link in the header.
Put the query into conversation scope and use an action to refresh when you click the button.
anonymous wrote : - However when a single employee is selected that single employee should be reloaded from DB prior to showing it in the details area. (To be sure to
| start the edit using the most up-to-date data.) When the employee has already been deleted, then a message should be shown instead and it should be removed from the list.
The Home should always load a instance from the db, not the EntityQuery.
anonymous wrote : - Ideally when opening another employee "area" in a new browser tab (by ctrl-clicking (with firefox) on an edit button or the "Employees" header) then the new tab should act independently from the first (i.e. loading the employee list once, when opened and refreshing a single employee on each selection).
This should happen if you are using conversations
anonymous wrote : * In seampay the PaymentHome had a "@RequestParameter Long paymentId;" declaration. Is it really needed? Seems to be unused, but it's hard to tell because there's always so much going on behind the scene when using seam.
Is the paymentId used in the code? If not, its not needed (@RequestParameter is just an injector).
HTH!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085276#4085276
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085276
18 years, 9 months