facebook

Looking for guidance on Struts2 – Spring – Hibernate web app

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #345590 Reply

    Hi guys,

    I have had a bit of struggle to get started with a web application that makes use of Struts2, Spring and Hibernate using MyEclipse.

    I was looking to use Maven as my build tool and deploy the generated WAR to Tomcat.

    I am using MySQL as the database with a chance of migrating to Oracle.

    The issue I have is there is on easy way to do this using MyEclipse. I can use the Dynamic Web Application project and then, add maven support. But that only adds a pom.xml. It does not add any appropriate dependencies.

    Nor does MyEclipse generate the relevant configuration files for Struts2, Spring and Hibernate.

    If I try to start from Maven, there is no relevant archetype. The webapp archetype does not come with built-in struts2, spring or hibernate support.

    Basically, I still have to google around a lot, spend a day or 2 to get all pieces to work together and then, use JBoss Hibernate tools to reverse engineer tables into entities.

    Am I missing something? Because all this seems like a lot of work.

    What I am looking for is:

    1. Automatic hibernate entity and DAO generation.
    2. Spring part is relatively easy to manage.
    3. Struts2 visual struts.xml management.
    4. Automatic front-end screen generation.

    Is this possible using MyEclipse? I am asking this because JBoss Seam does a lot of this for Seam based Web Applications. However, I am not looking to use Seam.

    Thanks and Regards,

    Ashish.

    #345621 Reply

    support-swapna
    Moderator

    Ashish,

    The archetype appfuse-basic-struts which is part of ‘Internal’ Catalog, creates a web application with Hibernate, Spring and Struts 2. However it would not generate any kickstart code. You will need to add the source files and dependencies.

    Coming to adding Struts2,Spring and Hibernate support to a web project, they can be installed as separate facets (Ex: right click on the web project > MyEclipse > Project Facets(capabilities) > Install Spring Facet).

    I suggest you also give MyEclipse for Spring a try for the Spring specific needs. Here is the link for a quick look : http://www.myeclipseide.com/me4s/

    I am afraid automatic hibernate entity generation,visual struts.xml management and automatic front end screen generation are not possible with MyEclipse.

    Let us know if you see any issues or if you have any questions.

    #345622 Reply

    Hi Swapna,

    I am disappointed to say the least.

    The biggest challenge with a web application that uses multiple frameworks is to get them to work together.

    And hence, configuration files form a very important part of any such kick start code.

    Given that there are free tools and tutorials out there that explain all this in great detail, I expected more from MyEclipse.

    People no longer use ANT. Most people use Maven. And Struts2-Spring-Hibernate or SpringMVC-Spring-Hibernate are the most popular framework choices.

    I am surprised that MyEclipse has not created it’s own Maven archetype for these 2.

    Anyway…I think I will stick with Eclipse for now in that case since MyEclipse is not giving me any additional value for now.

    Best Regards,

    Ashish.

    #345641 Reply

    support-tony
    Keymaster

    Ashish,

    Just to clarify what Swapna has stated, adding facets to the project will create the necessary configuration files and will add appropriate dependencies to the project, which can be added to or modified with the facet wizard. To add facets, right click on the project, select MyEclipse->Project Facets, and then choose the facet you want to install.

    If you install the Hibernate facet, although code generation is not automatic, you can go to the Hibernate perspective or Database Explorer perspective, connect to the database, select the tables, right click and have MyEclipse generate code for those tables.

    There is no UI generation capability in MyEclipse Professional but MyEclipse for Spring has Spring scaffolding capabilities that will also generate UIs to manage database tables, as well as adding the appropriate facets, though Struts2 isn’t included in the scaffolding.

    MyEclipse does not provide maven archetypes and there are plenty, from other providers, to choose from. As you will appreciate, the potential combination of technologies and frameworks is very large, so it would be very difficult for any IDE to anticipate every combination a user might want. The facet wizards should get you going a large part of the way and additional Hibernate code generation should also help eliminate some tedious work.

    If there are other features that you think we could reasonably provide, please feel free to request these in our Feature Request forum.

    #345651 Reply

    Hi Tony,

    Happy new year 2014!

    Thanks for the clarification.

    I am not so much hung up about Hibernate code generation as I am about config files.

    I can use Hibernate Tools to generate hibernate code or as you have mentioned, the database explorer.

    What I would like to do is:

    1. Create a maven web application or a web application and then add maven capability to it.
    2. The web app should have struts2, spring and hibernate support.
    3. Config files, ideally annotation based, that allow the frameworks to work together.

    The issue I have had is if I create a web app and then add maven facet, all I get is a pom.xml file with junit dependency. The struts2, spring and hibernate dependencies are not added to the pom.xml file.

    Ideally, you would have a wizard that would ask you about the relevant details – what frameworks, versions, database, etc. to use – and populate the pom.xml with the appropriate dependencies.

    Where I am at is I already have the pom.xml ready after doing a fair amount of googling. And I can use hibernate entities.

    It took me a couple of days though and had MyEclipse had the functionality or documentation (if it already has that functionality), that would have saved me a couple of days.

    Any advice is highly appreciated.

    Best Regards,

    Ashish.

    #345669 Reply

    support-tony
    Keymaster

    Asish,

    Thanks, a Happy New Year to you, too!

    I’m confused by what you’re looking for. Certainly, not all routes to adding the facets or natures will yield the maven dependencies but adding facets does create configuration files (like applicationContext.xml or struts.xml). If you use the maven option in the wizard for creating a web project, you get a pom with many JEE dependencies already added and you are able to specify a standard maven layout, if you wish. Once this is created, as you add other facets, additional maven dependencies are generated, along with config files. If there are missing dependencies that should be added or if config files are not being generated correctly, please let us know so we can fix those.

    I’m not a struts/hibernate/spring expert so I don’t know if there is more that could reasonably be done to make those combined frameworks easier to program with but, as I mentioned, there are many combinations of frameworks and technologies so it’s difficult anticipating exactly what developers may need.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Looking for guidance on Struts2 – Spring – Hibernate web app

You must be logged in to post in the forum log in