Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    integrate smart gwt ee with existing ejb sever side code

    Hi,
    Is it possible and easy to integrate existing ejb 3.0 code with smart gwt ee. Does smart gwt ee support ejb, as it support hibernate? Could someone provide me simple example?

    Regards.

    #2
    Could someone answer me pls?

    Originally posted by mnenchev
    Hi,
    Is it possible and easy to integrate existing ejb 3.0 code with smart gwt ee. Does smart gwt ee support ejb, as it support hibernate? Could someone provide me simple example?

    Regards.

    Comment


      #3
      By ejb i mean like session beans that contains the business logic.

      Comment


        #4
        mnenchev,
        You can use EJB's. Please study the source code for the Spring / Hibernate sample. In your case, the SupplyItemDao will be talking to your EJB beans, instead of using the Hibernate API's.

        Comment


          #5
          Thank you for the replay smart.gwt.dev, i began to think no one could answer me. Excuse me if i am asking stupid questions.

          So, i must use DMI, and in the DAOs to lookup manually the stateless beans?

          Regards.

          Comment


            #6
            Please take a look at the docs for DMI. It provides the general ability to look up a Java bean and call a method on it, and it can retrieve the bean via the request, the session, spring or other sources. You can call a stateless bean, an entity, or a controller, it's up to you.

            As far as EJB integration, you should consider writing a custom DataSource as shown in the samples. It should be possibly to write a single, generic custom DataSource that works with any of your EJBs, so that you don't have to write new code for each new EJB, you just create a new .ds.xml file for it.

            Comment


              #7
              Thanks. If i have time i will code some hello world application and i will post it here to discuss if this is the right approach and if there are other ways, using EJB 3.0.
              Regards.

              Comment


                #8
                This example is what we are following to talk to our EJBs:
                http://grprakash.googlepages.com/gwtwithejb

                Comment


                  #9
                  Yes, i have done the same for some small modules. And it is working, but the code is to much.
                  In order to display some simple database table in grid:
                  1) write entity bean
                  2) write stateless bean that does the business logic(CRUD and other)
                  3) write GWT service, that lookups(manually - that is little slow and the code is not clean**) the proxy to the bean

                  4) write datasource that uses the service
                  5) write UI that uses the datasource.
                  It is to much code just for simple thing!

                  So if smart gwt pro or ee could give me the opportunity to save time and write less code and it performance is good i prefer to buy it.
                  What do you think?
                  But first i will create simple app that completes the above task and compare the steps to those from above.


                  ** I saw somewhere EJB lookup in the init method, that is done only once?!?!
                  Regards.

                  Originally posted by levi
                  This example is what we are following to talk to our EJBs:
                  http://grprakash.googlepages.com/gwtwithejb
                  Last edited by mnenchev; 12 Jun 2009, 07:59.

                  Comment


                    #10
                    I think those steps pretty much sum it up.

                    You can create some helpers methods to do the JNDI lookup only once (cache it). I haven't had the time to see if Spring could come in handy here.


                    The DMI method from the EE docs looked very promising, but I couldn't get it to work with my existing server model.

                    Comment


                      #11
                      If you use Pro or EE with the SQL Connector or Hibernate Connector you eliminate all of those steps except writing the DataSource and writing the UI (and those latter steps can be done in Visual Builder).

                      If you need to use EJB, we can't help you eliminate the two beans the EJB requires even for simple database access, but with Pro you can avoid writing the GWT service or the need to write Java code for your DataSource - it's just a declarative XML file.

                      Comment


                        #12
                        Hi, isomorphic. I looked at the examples and the code and read the docs that are in the showcase. I have some questions.

                        1) If i use DMI and ejb, i need to create ds.xml in witch i specify the way the DAO object (in my case stateless ejb) is created (lookup)? And finally some ui component use the declared ds as it's operations are the methods implemented in the DAO? I.e. operations are mapped to the ejb methods?


                        2) What do you mean by custom generic datasource? I know that this is not smart gwt specific and i have to care how to implement this, but you could point me.

                        3) What about this real time messaging?!? I am interested. Is it comparable to light streamer? Is it fast (and stable) let's say 1k-3k messages per sec?

                        Originally posted by Isomorphic
                        If you use Pro or EE with the SQL Connector or Hibernate Connector you eliminate all of those steps except writing the DataSource and writing the UI (and those latter steps can be done in Visual Builder).

                        If you need to use EJB, we can't help you eliminate the two beans the EJB requires even for simple database access, but with Pro you can avoid writing the GWT service or the need to write Java code for your DataSource - it's just a declarative XML file.

                        Comment


                          #13
                          Is there any documentation exactly for smart gwt ee?

                          I forgot to ask, something important. What about security? Is there any generic way to implement security or we have to implement it manually(up to now in my gwt projects i implement security as they are desktop applications i.e. on every view i add permissions and roles and on every controler method (RPC service method) i add permissions and roles. I think that EE should have some way to implemet security as it is client-server framework. What about the spring security - "acegi" for gwt like applications?
                          Last edited by mnenchev; 16 Jun 2009, 02:13.

                          Comment


                            #14
                            any response :)

                            Comment


                              #15
                              Taking these out of order:

                              2) a "custom DataSource" is actually a SmartGWT concept. See this sample. You can most likely write a single DataSource class that can be reused for all of your EJB entities, so that all you need to do to connect to a new EJB entity is create a .ds.xml file for it (or generate it, if you have Enterprise). A forthcoming example will show doing this for Hibernate.

                              1) Yes that's correct if you choose to go with EJB and you use DMI as your integration approach. A custom DataSource will result in less code overall as soon as you connect to 2 or more EJBs.

                              Note that in both of the above approaches, creating the DataSource .ds.xml file itself is not a redundant step because this DataSource is used to provide fields for UI components, as well as server-side validation and many other functions.

                              3) Messaging hasn't been ported to SmartGWT Enterprise yet, but it will appear there soon. Yes it's comparable to Lightstreamer, fast and stable.

                              On security: normal J2EE security approaches work, and SmartGWT EE 1.2 / SmartClient 7.1 will include built-in support for declarative role-based security that connects to JEE security or JAAS.

                              On docs: See the sticky thread "SmartGWT documentation" - SmartClient and SmartGWT share the same server framework, it all applies.

                              Comment

                              Working...
                              X