12 Replies Latest reply on May 7, 2009 1:17 AM by kragoth

    Using Seam without a database

    rsseam2
      We have a need to deploy Seam/Richfaces app on Weblogic 10.3. The architecture is an SOA integration effort.
      What do I have to change to remove the database and JPA dependencies for deployment. I don't think just adding
      <core:init transaction-management-enabled="false"/> quite handles the situation. 
        • 1. Re: Using Seam without a database

          Please vote for JBIDE-2630

          • 2. Re: Using Seam without a database
            kragoth

            Why can't you run SEAM without a database?


            Sure there maybe java library dependencies that need to be sorted out, but in the application I'm working on SEAM has no idea about a database. Only our service layer (insert Spring, Hibernate etc here) knows about the database. SEAM is used only for its Conversation mechanism.


            So I don't see why you couldn't just deploy without any database connection info as it is right now.


            In my components.xml the relevant lines I have are


            <core:init transaction-management-enabled="false" debug="false" />
            <transaction:no-transaction />
            

            • 3. Re: Using Seam without a database
              gonorrhea

              So you're not using Spring WebFlow (IIRC it has conversation scope, or equivalent).


              You still have a valid point.  I'm not sure that the Seam framework designers conceptualized using Seam as an auxiliary framework for Spring, etc...

              • 4. Re: Using Seam without a database
                kragoth

                No we are not using Spring WebFlow. At the time Spring WebFlow had way too much xml for our liking. We are trying to have as little xml configuration files in our system as possible. (For many varying reasons most of which are debatable. But, that was the decision and not really relevant to this topic :P)


                The only issue I have with SEAM is that it tries to combine too much into a single layer. I should be able to choose the Conversation management module as a seperate product from the Extended Persistence module. If this was done then I'm sure SEAM would be compatible with a lot more frameworks.


                However, this is really not that important. I have found that if I spend enough time understanding how SEAM works I can make it work for whatever I need it to. We will never use extended persistence context for a lot of very good reasons. I would be surprised if any Large project would.


                However, the conversation management of SEAM is pretty good. It does lack a defining way to navigate between conversations when you want to pass parameters AND you don't want to use xml. (See another topic I posted in about a NavigationManager I wrote to get past this)


                But for the original question there is no reason at all to vote for some JIRA that is already supported. The only thing I can think of is modifying Seam gen to do this for you.

                • 5. Re: Using Seam without a database
                  gonorrhea

                  Tim Evers wrote on May 06, 2009 01:20:


                  However, the conversation management of SEAM is pretty good. It does lack a defining way to navigate between conversations when you want to pass parameters AND you don't want to use xml. (See another topic I posted in about a NavigationManager I wrote to get past this)


                  When you say it does lack a defining way to navigate between conversations are you referring to a conversation/workspace switcher?


                  Otherwise, you can outject context variables into session scope so multiple LRC's can access it.

                  • 6. Re: Using Seam without a database
                    kragoth

                    Outjecting into Session Scope is exactly what I don't want to do. Infact most developers aggree that global variables are a bad idea. So how is the Session context any different? Besides the fact that in a relatively complex web application you can't just inject into the session scope because the risk of over writing a value is too high.


                    If you have any situation where the screens you are viewing can be recursive in nature then a session variable is very dangerous.


                    The second thing about outjecting into session scope is type safety. I lose all type safety when passing parameters around. It also means that each developer has to go figure out what a particular module wants him to outject in order to utilise it. This is way to much work and opens the door for way to many errors.


                    My NavigationManager allows for type safe navigation between modules. No outjecting into the Session scope. And the developers in my team can call a single method which details the contract of what data needs to be supplied to navigate to a particular module. (All of our modules are seperate converstaions)


                    With regards to a conversation/workspace switcher. I use this functionality heavily within my NavigationManager to allow the type of navigation I have described.


                    I'm not saying that SEAM doesn't allow what I'm talking about, I just don't think that it does it in a way that is helping the community to do things better.


                    Another thing I think SEAM should do is allow Injection by type instead of name. If I could just annoatate my SEAM bean with @SeamComponent and then inject it with just @In that would be way better. (I'm not saying take away support for named beans, but this would aleviate the need for yet another string token.

                    • 7. Re: Using Seam without a database
                      gonorrhea


                      It does lack a defining way to navigate between conversations when you want to pass parameters AND you don't want to use xml.


                      I haven't used nested conversations extensively, but that may solve your problem.  What exactly is an example of a use case that may require navigation b/n conversations?  Typically LRCs are independent/isolated and otherwise you can nest conversations inside a parent conversation...

                      • 8. Re: Using Seam without a database

                        Arbi Sookazian wrote on May 06, 2009 17:45:



                        It does lack a defining way to navigate between conversations when you want to pass parameters AND you don't want to use xml.


                        I haven't used nested conversations extensively, but that may solve your problem.



                        Lucky you. Stay away of them as much as you can.



                        What exactly is an example of a use case that may require navigation b/n conversations?



                        It is more like, what do you do if you are in conversation C which is nested in conversation B which is nested in conversation A, and want to pass some information from C to A at the moment that C ends (and maybe, or maybe not, end B too)?




                        Typically LRCs are independent/isolated and otherwise you can nest conversations inside a parent conversation...



                        Well, nested conversations are not that well communicated either...




                        • 9. Re: Using Seam without a database

                          I discussed this very same nested conversation a while ago, and got absolutely no answer

                          • 10. Re: Using Seam without a database

                            Sorry, I was meaning to say:


                            I discussed this very same nested conversation limitation a while ago, but got absolutely no answer

                            • 11. Re: Using Seam without a database
                              gonorrhea

                              Honestly, I would say that the Seam core devs need to be more responsive on this forum.  When Seam was @ 1.2 and in the old JBoss forum, not here, PMuir responded very often and he was very helpful.  It's funny, you'll get more and quicker responses on the Web Beans forum than here.  In comparison, the RF and JBoss tools guys are more responsive than the Seam core devs.


                              In any event, you have a good question and I'm not sure if it's possible to solve it or not with the current API.


                              You should be able to determine programmatically what is the pid (parent LRC) for whatever level nested LRC is current in your component.


                              e.g.:


                              getParentId
                              
                              public String getParentId()
                              
                                  Get the id of the immediate parent of a nested conversation 



                              http://docs.jboss.org/seam/2.0.2.SP1/api/org/jboss/seam/core/Conversation.html#getParentId()


                              As far as how to pass data nested <--> parent, I'm not too sure about how the API handles that...


                              Or what if the conversations are not nested but instead parallel?  e.g. user opens 2 or more tabs for same Seam web app?  The multiple LRCs are running in parallel but there is only at most one LRC that is foreground/current and the rest are background.


                              So what if the functional requirement demands that a change in one LRC must be reflected in the other tab/LRC when the user switches tabs?  Do you then use SESSION scope for that particular piece of data, etc?


                              I guess the point is: how well/easily does Seam handle related/integrated LRCs whether they are nested or parallel?


                              and what about Seam 3 and Web Beans, are there plans to accommodate this?

                              • 12. Re: Using Seam without a database
                                kragoth

                                This kind of functionality is not available out of the box. Hence why I had to write my own NavigationManager. I start all my conversations as parallel conversations (because nested conversations are poorly documented and I'm not sure they are really that well supported). But I logically treat them all as nested. I have my own Conversation Stack that I manage in my NavigationManager. So if a user has conversations A -> B -> C and they want to return to A (and pass data or not), B will be ended at the same time.


                                At the end of the day this sort of navigation would be extremely common in any complex system and yet when I first started working with SEAM no one could tell me how to do this without session variables or xml.


                                I would submit my NavMan code but it does have some application specific code in it now. (Build my own breadcrumb stuff etc cause I now own the conversation stack :P)


                                Just a side note for anyone interested in using nested converstations. The first thing I would say to you is, Don't! :P but, if you really must have nested converstations then understand that the @PerNestedConversation (or whatever that annotation is) is not actually fully understood. And debugging nestsed conversations can drive you mad! :P