Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best framework for developing a Java CRUD for an existent database?

We have a Java application with lots of config tables on the database (Oracle). We'd like to have Web-based GUIs for setting up these tables, that we currently update via SQL queries. What is the simplest way to develop CRUDs for a subset of our database? Is there any Java-based framework for doing this?

like image 966
Otavio Avatar asked Jun 06 '10 15:06

Otavio


2 Answers

IMHO, there is quite a good solution for managing application data without need to write any additional code.

LightAdmin is a pluggable Java library for Spring/JPA backed applications, which provides standard CRUD functionality, filtering, JSR-303 validation through clean and simple UI. It provides DSL for interface customization and you can plug/unplug it from your application whenever you want.

Here is a small example of DSL configuration customization:

@Administration( Booking.class )
public class BookingAdministration {

public static ScopesConfigurationUnit scopes( final ScopesConfigurationUnitBuilder scopeBuilder ) {
    return scopeBuilder
        .scope( "All", all() )
        .scope( "Smoking Apartments", specification( smokingApartmentsSpec( true ) ) )
        .scope( "Non Smoking Apartments", specification( smokingApartmentsSpec( false ) ) )
        .scope( "Long-term bookings", filter( longTermBookingPredicate() ) ).defaultScope().build();
}

public static FiltersConfigurationUnit filters( final FiltersConfigurationUnitBuilder filterBuilder ) {
    return filterBuilder
        .filter( "Customer", "user" )
        .filter( "Booked Hotel", "hotel" )
        .filter( "Check-In Date", "checkinDate" ).build();
}

public static FieldSetConfigurationUnit listView( final FieldSetConfigurationUnitBuilder fragmentBuilder ) {
    return fragmentBuilder
        .field( "user" ).caption( "Customer" )
        .field( "hotel" ).caption( "Hotel" )
        .field( "checkinDate" ).caption( "Check-In Date" )
        .field( "smoking" ).caption( "Smoking" )
        .field( "beds" ).caption( "Beds" )
        .build();
}

public static DomainTypePredicate longTermBookingPredicate() {
    return new DomainTypePredicate() {
        @Override
        public boolean apply( final Booking booking ) {
            return booking.getNights() > 20;
        }
    };
}

public static DomainTypeSpecification smokingApartmentsSpec( final boolean isSmokingApartment ) {
    return new DomainTypeSpecification() {
        @Override
        public Predicate toPredicate( final Root root, final CriteriaQuery<?> query, final CriteriaBuilder cb ) {
            return cb.equal( root.get( "smoking" ), isSmokingApartment );
        }
    };
}

}
like image 143
max-dev Avatar answered Oct 05 '22 17:10

max-dev


Telosys Tools ( http://www.telosys.org/ ) has been design for this kind of job.

It uses an existing database to generate source code (typically CRUD screens) And it’s possible to customize the templates if necessary

The best way to try it is to follow the tutorial: https://sites.google.com/site/telosystutorial/
(there’s a stack for Spring MVC / Spring Data / JPA )

See also : http://marketplace.eclipse.org/content/telosys-tools

like image 35
John T Avatar answered Oct 05 '22 18:10

John T