我们有一个
Java应用程序,在数据库(Oracle)上有许多配置表.我们希望有基于Web的GUI来设置这些表,我们目前通过SQL查询更新这些表.为数据库的子集开发CRUD的最简单方法是什么?这样做有没有基于Java的框架?
解决方法
恕我直言,有一个很好的解决方案来管理应用程序数据,而无需编写任何额外的代码.
@L_301_1@是一个可插拔的Java库,用于Spring / JPA支持的应用程序,它通过干净简单的UI提供标准的CRUD功能,过滤,JSR-303验证.
它提供用于界面定制的DSL,您可以随时从应用程序中插入/拔出它.
以下是DSL配置定制的一个小例子:
- @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 );
- }
- };
- }
- }