Announcement

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

    SQL DataSource definition only in Java possible ?

    The documentations are always referring to use the ds.xml configurations to use with a SQL datasource.

    We would prefer using only Java-Code, because of Internationalization without the jsp approach, reuse of DataSourceField definitions and compiler-correction.
    Another aspect is to separate data related and presentation informations ( like "title" attributes. )

    Is it possible to declare a SQL datasource only with Java Code.
    If so, is server and client logic like validation also guaranteed?
    How to set the tableName or serverType in the Java Code?

    #2
    You can have the majority of the .ds.xml file derived on the fly from a Java Bean - see the QuickStart Guide, Server Framework chapter. This includes simple validation (such as forcing the correct data type - integer, date, etc) but not advanced validation (comparison to related values for example) since there is no standard Java declaration for validation of this kind.

    However, JSR303 (bean validation) makes it possible to declare more validation rules in Java - support for this is planned, but you can speed up the process via Feature Sponsorship if it's important for your application.

    Comment


      #3
      To use Java Beans for field definitions (define name and type) and validation is one aspect.

      But what about a complete definition of the SQLDataSource?
      Are there all attributes and properties available somehow (except for validation)?

      If so, how to set a customSQL and tableName for example?

      Comment


        #4
        There is no Java syntax for this, no benefits would be gained from running such a definition through the Java compiler. In fact, it would make the product worse by requiring a Java compile to change things that you can currently change without a compile.

        Comment


          #5
          Hello,
          Is Java Bean Validation using jsr-303 still planed?

          Comment


            #6
            Still planned, but rarely requested and so not at the top of our list. If it's critical for you, there's both Feature Sponsorship and the possibility of rolling your own using the DataSource.addDynamicDSGenerator() API.

            Comment

            Working...
            X