[JBoss Seam] - Re: Basic Seam questions
by gavin.king@jboss.com
There are several related problems:
(1) you want the user to be able to freely navigate backward during a conversation
(2) but you don't want them to be able to navigate backward once the conversation ends - or rather, its ok to navigate back, but if they try to submit a form, you want to stop them let them know that the conversation is over
(3) you also want them to be able to refresh pages, and see the conversational state, but you don't want the browser to resubmit the form
(4) you also want to be able to display transient messages
obviously (1) and (2) conflict - if you have no conversations, its very difficult to tell when they are allowed to go back and resubmit, and when they are not.
(3) and (4) also conflict - you have a choice between using redirect-after-post, which makes it difficult to display success/error messages, or not using it, which makes the browser try to resubmit the form when the user hits refresh
Conversations solve the first conflict, because the server now knows when the conversation is over. Try this in the booking demo: you can back button as much as you like - but if you confirm a booking, and then try to go back and re-confirm it, Seam detects that and gives a nice message.
They also solve the second conflict: you can user redirects as much as you like, and messages and other state remain on the server across the redirect.
When I do my Seam presentation I demo all these things, and it makes a lot more sense to *see it* than have it explained to you.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995189#3995189
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995189
19 years, 4 months
[EJB 3.0] - MapKey, JoinColumn and referencedColumnName
by jazir1979
Hi all,
I'm trying to use a map-based relationship on a non-PK, provided below. The EJB3 spec states that "when used for relationship mappings, the referenced column is in the table of the target entity".
However, when I do this, I get "Unable to find column with logical name" errors from Ejb3JoinColumn.java when deploying.
To get around this, I tried swapping the values of the "name" and "referencedColumnName" attributes in my JoinColumn annotation. The relationship then works perfectly fine for reading and updating, but when I go to delete entities that have such a relationship (and cascade ALL), the operation fails with the following:
| org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of Organisation.brandMessageId
| at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:171)
| at org.hibernate.tuple.AbstractComponentTuplizer.getPropertyValue(AbstractComponentTuplizer.java:58)
| at org.hibernate.tuple.AbstractComponentTuplizer.getPropertyValues(AbstractComponentTuplizer.java:64)
| at org.hibernate.tuple.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:76)
| at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:307)
| at org.hibernate.type.ComponentType.nullSafeGetValues(ComponentType.java:280)
| at org.hibernate.type.ComponentType.nullSafeSet(ComponentType.java:235)
| at org.hibernate.persister.collection.AbstractCollectionPersister.writeKey(AbstractCollectionPersister.java:723)
| at org.hibernate.persister.collection.AbstractCollectionPersister.remove(AbstractCollectionPersister.java:1010)
| at org.hibernate.action.CollectionRemoveAction.execute(CollectionRemoveAction.java:28)
|
I debugged using the source and found that it was trying to reference Long.getBrandMessageId() instead of Organisation.getBrandMessageId()!!
Here is the relevant portion of my mapping. I've provided it in the way that works except for deletes (but seems to go against the EJB3 spec). To see the other way, just swap msg_id and brand_msg id for the name and referencedColumnName.
| @Column(nullable = true, name = "brand_msg_id")
| public Long getBrandMessageId() {
| return brandMessageId;
| }
|
| public void setBrandMessageId(final Long brandMessageId) {
| this.brandMessageId = brandMessageId;
| }
|
| @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
| @JoinColumn(name = "msg_id", referencedColumnName = "brand_msg_id")
| @MapKey(name = "locale")
| public Map<String, Message> getBrandMap() {
| return brandMap;
| }
|
| public void setBrandMap(final Map<String, Message> brand) {
| this.brandMap = brand;
| }
|
My tables are:
| Organisation.id (PK)
| Organisation.brand_msg_id
|
| Message.id (PK)
| Message.msg_id
| Message.locale
| Message.message
|
I've browsed Jira and found some issues with JoinColumn and Map relationships, but nothing that really looks like this.
So, my questions are:
1) is the check that Ejb3JoinColumn.java does going against what is written in the EJB3 spec?
2) if not, should I have name="msg_id", referencedColumnName="brand_msg_id" above?
3) if so, what is happening when it tries to cascade deletes to the messages Map but gives the error shown above?
thanks in advance,
Daniel.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995187#3995187
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995187
19 years, 4 months
[JBoss Seam] - Seam And ICEFaces menubar
by david.alves
Hi I'm trying to build a menu using a Seam action as a backing bean for ICEFaces menuBar component.
I goes something like this:
MainMenuAction
| @Stateless
| @Name("mainMenuAction")
| @Scope(ScopeType.SESSION)
| public class MainMenuAction implements MainMenu {
|
| @In(required = true)
| User user;
|
| @Logger
| Log log;
|
| @Out
| public List<MenuItem> mainMenu;
|
| public String getMainMenu() {
|
| mainMenu = new ArrayList<MenuItem>();
| MenuItem mainClassifieds = new MenuItem();
| mainClassifieds.setIcon("xmlhttp/css/xp/css-images/menuitem.gif");
| mainClassifieds.setValue("Opt1");
|
| MenuItem searchClassified = new MenuItem();
| searchClassified.setIcon("xmlhttp/css/xp/css-images/menuitem.gif");
| searchClassified.setValue("Op2");
|
| MenuItem addClassified = new MenuItem();
| addClassified.setIcon("xmlhttp/css/xp/css-images/menuitem.gif");
| addClassified.setValue("Op3");
|
| mainClassifieds.getChildren().add(searchClassified);
| mainClassifieds.getChildren().add(addClassified);
|
| MenuItem myClassifieds = new MenuItem();
| myClassifieds.setIcon("xmlhttp/css/xp/css-images/menuitem.gif");
| myClassifieds.setValue("Opt4");
|
| mainMenu.add(mainClassifieds);
| mainMenu.add(myClassifieds);
|
| return null;
| }
| }
|
mainMenuPanel.xhtml
|
| <html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:ice="http://www.icesoft.com/icefaces/component">
| <body>
| <h:form>
| <ice:menuBar orientation="vertical" >
| <ice:menuItems value="#{mainMenuAction.mainMenu}"/>
| </ice:menuBar>
| </h:form>
| </body>
| </html>
|
|
I'm getting the following exception:
| 01:27:11,548 ERROR [D2DFaceletViewHandler] Problem in renderResponse: /main/mainMenuPanel.xhtml @9,63 value="#{mainMenuAction.getMainMenu}": Bean: org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$1503199b, property: getMainMenu
| javax.faces.el.PropertyNotFoundException: /main/mainMenuPanel.xhtml @9,63 value="#{mainMenuAction.getMainMenu}": Bean: org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$1503199b, property: getMainMenu
| at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58)
| at com.icesoft.faces.component.menubar.MenuItems.getValue(MenuItems.java:82)
| at com.icesoft.faces.component.menubar.MenuItemsRenderer.encodeChildren(MenuItemsRenderer.java:54)
| at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:524)
|
I just started integrating ICEFaces with Seam so if this is an extremely n00b question I apologize in advance, butI've tryed a lot of variations.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995183#3995183
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995183
19 years, 4 months