Steps SimpleDateFormat - create a class that encapsulates the format of the date you are creating. Parse the date sent using the method to ensure it meets date formatting requirements. Throw a parse exception if the date is invalid. Create a sqlDate from the parsed date. Use the number of milliseconds from January 1, 1970, 00:00:00 GMT as an input into the method. This ensures the accuracy of the formed SQL date. Return the sqlDate to the method caller.
Sometimes I think I am the only Java programmer in Australia who uses the Java Framework called Vaadin. For the most part my colleagues are deeply entrenched in Spring and have no time to lift their heads out of the Spring Documentation to experiment with a different type of Framework. One of the interesting features of Vaadin is its simple, but effective SQL Container Add On . It provides a simple layer on top of a database. The add on does not provide a JPA interface into the data ( this feature is supported by a different commercial add on ) it does however provide a nice, simple object model for queries and database connections. This short blog will focus on a Table Query using the SQL Container Add On. I will create other blogs in the future describing more complex features of the Add On. The first thing you need to establish is a Connection Pool. SimpleJDBCConnectionPool connectionPool = ne...
My previous post concerning the Vaadin SQL Contanier covered how to create a SQL Container and a Table Query using the Vaadin SQL Container Add On. In this post I will give a very short overview on how to filter the results of a Table Query. A filter can be applied to a SQL Container so that the results of that Table Query can be narrowed to a specific set of rows within the table. For example, lets assume you have created a Table Query on an address table within your database. TableQuery q = new TableQuery("address", connectionPool); Your requirement is to filter the data within that Table Query to a specific suburb, street and postcode. To achieve that requirement you create three filters using the Compare.Equal object. The values for suburb, postcode and street are passed in as parameters. Compare.Equal suburbFilter = new Compare.Equal("suburb", suburb); Compare.Equal postcodeFilter = new Compare.Equal("postcode", postcode); Compare....
Comments
Post a Comment