Rapid developement of java web-app, using existing mongo database - java

Want to fast implement little web-app using:
Spring MVC
GWT for frontend
Hibernate
Maven
(found that Spring Roo provide most of needed architecture)
Problem is, I have exiting Mongo database.
Is any way to create data schema from existing mongo database (found reverse engineering for relational databases)? Or i have to define entities, according to mongo db by hand?

We've once tried to pursue a rapid prototyping approach for an auto-generated backend based on an existing MongoDB database. The code is open source and available at http://sourceforge.net/projects/springmorphia/
Disclaimer:
This is a student's bachelor thesis, so you might want to review the code.
We've never used it for its intended purpose, since we were not too thrilled with Spring Roo (specifically the stability of the API, number of bugs we ran into,...).
However, this project is more than a year old, so things might have improved. Which also means that the Spring Roo version is heavily outdated.
It's probably a good starting point if you want to head in that direction.
If you don't intend to use a rapid prototyping approach, I'd still rebuild the database once and import the existing data. Only if you want to continuously generate your code based on an evolving database it will pay of, IMHO.

Related

Java Application with plug and play db

My company has a product that we sell as a solution to mediocre firms, they are ok with using java but they have different opinions on db due to licensing and other technical/resource issues.
I was wondering if there is a way i can create the app in such a way that during installation we configure the database (select weather mysql/oracle and input/generate connection strings, allocate driver, e.t.c.) and it works similarly as the other db. I have heard about hibernate being able to generate table but havent ever worked on it before.
I need an opinion and if possible reference to a guide. thank you in advanced. sorry for a stupid question, i only know basics of java, haven't yet worked on ORM or any other framework.
Yes,
The JPA (java persistance API) allows you to do what you're looking for. You will be needing a JPA provider (such as hibernate, Apache OpenJPA or eclipse link among others).
You will be able to automatically create the schema of your database according to the objects you need to map into it.
Here are few links to get started:
https://docs.oracle.com/javaee/6/tutorial/doc/bnbpz.html
https://www.tutorialspoint.com/jpa/
http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/SettingUpJPA/SettingUpJPA.htm
Many JPA ressources will point to java ee ressources and tutorials, since it is heavily used with java entreprise edition, but the API itself can be used with the standard java platform.

Whats a good Workflow solution for an existing Wicket Web application?

I' writing a web application with Wicket 1.4.X, Hibernate 3.6, and Spring 2.5.6.
I have some objects
For Example:
Person
name
SSN
positon
etc....
now some fields are not editable. say SSN, however other fields like position, are only editable for managers. If a supervisor makes the change, it gets forwarded on to a manager for approval. I have a homegrown system currently in place for part of this. However, it seems to me that an actual workflow system would allow me to collect all of the rules into one nice convenient location rather than having them scattered around my code.
I'm looking for a system that is:
Simple
Integrates well with the technologies I'm already using
Doesn't require a separate server
(the app is internal I don't need "on-the-fly" rules changes)
I keep coming across references to jBPM having no "real" experience with workflows it looks like the easiest/most efficient route to install it is by installing Drools. The Drools and jBPM integration Guide even talks about Spring integration.
However, the documentation felt sparse and I didn't completely understand what I was looking at. Before I start down the (what I assume to be long) road of Drools/jBPM I wanted to get a community consensus from people smarter then me on the subject of workflows.
UPDATE:
I talked with my boss about this issue. We currently have another "in-house" application. (currently maintained by external contractors) that's using Stellent, now known as
Oracle Universal Content Management with Oracle BPM. While I should probably learn these technologies since I will more then likely wind up maintaining that other app, it just feels counter productive to integrate a whole UCM/BPM solution into the guts of my application if I've already setup the Front-End and the DB back end.
(Caveat: My only experience with a CMS was Plone, about 2 years ago and I am not a Python programmer.)
I guess you could just use wicket auth roles. http://wicket.apache.org/learn/projects/authroles.html

How to deploy Java App Engine application on another cloud?

I have written a relatively simple Java App Engine application which I would like to be able to port to another cloud provider.
I am using the JDO datastore API so I think my data handling should be portable to other backends as listed here: http://www.datanucleus.org/products/accessplatform/index.html
I would ideally like to deploy my application onto EC2 with minimal code changes. What is my best approach?
Note: I am aware of the http://code.google.com/p/appscale/ project but I want to avoid using this as it doesn't look like they are updating very often.
AppScale remains your best option to avoid rewriting any code. They do keep up to date with official App Engine - for instance, they just released preliminary support for Go. Even if they weren't so assiduous at keeping up to date, though, this would only be relevant if some feature you required wasn't yet supported - and it sounds like your needs are fairly basic.
JDO should be trivial, there might be some Google specific configuration here and there but generally it should be easy. The storage model Google promotes is not bad for RDBMS either, but you might need to fine tune your model depending on the backend you end up with.
If you're not using the low-level Google APIs, you should be pretty much there.
I managed to get my application working on EC2 using the following components.
Tomcat 7
Datanucelus
HBase
I had to manually create a table in HBase for each of my data classes but was able to configure Datanucleus to auto create the columns.
I also had to change my primary key value generation strategy from identity to increment as per this table of supported features.
http://www.datanucleus.org/products/accessplatform_3_0/datastore_features.html

spring roo vs appfuse generate service /dao layer

I am looking for feedback from experienced users on spring roo and appfuse. Which do you think does a better job reverse engineering database tables and generating a service layer, dao layer, and jpa entities?
If I am not mistaken, spring roo currently cannot reverse engineer a database.
Just a quick update to inform all users that stumble upon this thread now (or at least after today :)); With the new 1.1.0 release, Spring Roo now does support incremental database reverse engineering out of the box. See this release annoucement.
As a comment on the actual question: I don't think either of the two is way better than the other in the actual entity generation, but there is a big difference of course between AppFuse and Spring Roo aside from the entity generation. If you actually need DAO's, this is something that comes out-of-the-box in AppFuse and put partly in Spring Roo, but there is also a great addon for Spring Roo (Hades addon) that does a great job at this, maybe even better than AppFuse. Main reason to go for AppFuse, in my humble opinion, is if you require another Web Framework (ie Wicket. Tapestry or JSF) as front end then Spring MVC or GWT, as these are currently the only well supported Web Frameworks within Spring Roo (more coming though, like Flex etc.). Other reason you might go for AppFuse is if you want to use an IDE with full intellisense and code-completion support, but don't want to use Eclipse (you can use other IDE's, and build works perfectly well with Spring Roo, but due to the AspectJ files, which aren't recognized by Netbeans, other IDE's then Eclipse currently don't do code completion well for the Spring Roo generated/managed files).
But if you don't mind Eclipse (or better even the Spring Tools Suite) and do want to use GWT and/or Spring MVC, I'd recommend Spring Roo. Main reasons to go for Spring Roo is the, in my humble opinion, higher productivity, far better support, far higher momentum and activity, lower learning curve (for quick CRUD app generation) and of course the Rails like command shell from which you can quickly setup and configure your application.
Ps. Note that I haven't used AppFuse actively for over a year, so my knowledge of AppFuse is a bit rusty.
Roo is good to quickly put up stuff up (round-tripping is amazing)..but the lack of out-of-the-box provide for a services layer puts my needs in a bind. I know I can do #Services annotation and place code appropriately as mentioned in the documentation(too much work at startup). I wished Roo gave me a choice to have a services+dao layer...out-of-the-box.
That would (have made)/make Roo a killer app, imho
You are correct that you can't reverse engineer a database in Roo. There's an open JIRA item for this which you can vote up.
However, you could try using the Eclipse Hibernate tools to reverse engineer your database, then modify those objects to make them Roo Entities. That probably would involve a lot of manual work though.
For AppFuse, there's the AppFuse Maven plugin which can create the entire AppFuse project for you from an existing database. I'm not sure if it's currently working though, because the last person I mentioned it to said they couldn't get it working.
Depending on your requirements, you may also want to give the Grails framework a try. There's a tool called GRAG that can reverse engineer a Grails application from a database.
The ROO-435 issue is actually our most requested feature, so I'll be implementing that in Spring Roo within the next few weeks. In the meantime, Jason's suggestion of using the Eclipse Hibernate tools to create JPA annotated entities is an immediate solution that is fully Roo compatible.

Hibernate CRUD à la Ruby on Rails' Scaffolding

Do you know of any tool that would do like Ruby on Rails' Scaffolding (create simple CRUD pages for any particular class to allow quickly populating a database with dummy data), only which used Java classes with Hibernate for database access, and JSP/JSF for the pages?
It is a drag when you are programming one part of an application, but need data that can only be added with another part that is not ready yet, or very cumbersomely by directly inserting it into the DB.
Grails is a very nice Rails-like framework built on top of Spring MVC. For persistence, they use GORM, which is basically an ActiveRecord-like framework built on top of Hibernate. Pretty slick.
If you already have Hibernate entities, they can actually be used immediately in Grails with no additional work.
You can try Telosys Tools, an Eclipse plugin for
code generation (scaffolding) working from an existing database
with customizable Velocity templates.
It's very simple and easy to use.
The tutorial for code generation with Spring MVC and Spring Data is here : https://sites.google.com/site/telosystutorial/
See also : http://tools.telosys.org/
Eclipse Marketplace : http://marketplace.eclipse.org/content/telosys-tools
I'm a little late on this one but it popped up in the "Related" links →
JBoss Seam and it's Seam Gen tasks are exactly what you are looking for (Hibernate + JSF). You can generate an entire web app from a Hibernate fronted database in seconds.
you can use grails. Grails tries to be Groovy on Rails -- uses Rails behind the scene for scaffolding, etc. Since you can pretty much write full scale java code in a groovy class, you can have the CAKE and EAT IT too.
Grails is somewhat different from Rails, even though it was based on Rails and has a similar feel. Grails uses spring to help wire your services together. The environment is not only dynamic (with Groovy) but also allows you to use Java (static environment) as well. It is really cool, especially if you're coming from a java environment. The Grails folks took the Rails idea and expanded it using the Domain Driven Model. Rails is still data model centric where you have to deal a lot with the database to create your objects (which is called a model), where as Grails allows you to design applications using the true domain object model where you deal with objects from the domain class' perspective instead of the database.
There is a good tutorial here on how to do this in Netbeans. I've used this wizard before with good results. Out of the box you can select which persistance framework to use and the JSF pages it produces are quite nice and clean.
Spring + AspectJ + Hibernate + CLI = Spring Roo RAD framework.
Give it a try.

Categories

Resources