| home | get started | manual | download | license | source | sf.net home |
Main Goal. The idea behind SideNail is quite simple: to make the minimum effort to map database rows into Java objects.
The following example works. No matter the number or types of your "student" table columns.
List<?> students = SideNail.map("select * from student");
No Magic. In order to accomplish it's main goal, SideNail takes advantage of the java.sql.ResultSet's capability to know column types (implemented by JDBC Drivers). This also means that there's no need to specify class/table mapping through XML or annotations.
This is a constraint in SideNail's design: not to depend on external files nor resources to map objects. Not even for logging.
Yes, we wan't to keep SideNail's design as simple as possible.
Dynamic. So, how to know what are we mapping since we have no information about database schema(s)?. Again, SideNail takes that information from java.sql.ResultSet instances' metadata. This means that you specify the columns you want to map from a table (or a set of tables), in your SQL query. SideNail will automatically create a new class for your query is you don't specify a class for it, and will also populate a list with the mapped rows.
As a corolary of this, your application could create new tables dynamically and SideNail will know how to map them.
SQL. SQL is a well-known, widely used query language. We decided not to make another attempt to make it portable. We think that this work would have no end, and also it could hide cool but non-portable database features. However, you can use a wide variety of SQL generation APIs along with SideNail.
This is the main reason why SideNail's work starts when result-sets are available.
By the way, if you want to include the full-text search provided by your database (mostly with a non-portable syntax feature) in your application, maybe you might SideNail useful. In particular, SideNail's "structured mapping" feature can help you with "rank" columns four your mapped objects almost making no extra effort.
Small footprint. Again, SideNail won't require any special access to disk. Not for reading and not for writing data. It's memory footprint (for storing dynamically generated classes) can be easly managed through SideNail sessions.
And since SideNail is not a persistence API, it won't retain any reference to objects in memory, There's no objects cache. You're only simplifying mapping. That's it. This also affects performance in a good way. Much less memory to garbage collect. Thus, no CPU wasted on it.
Performance. Reflection, which is the obvious SideNail mechanism for filling up objects, is working every day faster in Java. We invite you to check SideNail's performance by yourself.
Compatibility with existent reflective APIs. We have used SideNail along with flexjson, XMLEncoder, and Unified EL (in JSPs) without any sort of problem.
Behind the scene, SideNail compiles dynamically Java bean classes, so why would there be an incompatibility problem?
Check out ASM the compiler used by SideNail for further information.
Further work. Since SideNail is a young idea we're finding new patterns of usage every day. We're having ideas for new software based on it.
In particular, we believe that SideNail can help you with legacy systems and small demos.
Please don't hesitate in sending an email to project admins for any question or suggestion. We also need to do lots and lots of testing. In this respect, any feedback will be very welcome.
Download it, copy sidenail.jar and asm.jar to your class path and you're done. You can start dynamically mapping your database there where you were manually mapping from a result-set.
Note that you must to start a SideNail session (SideNail.start()) before you can start mapping. The mapped objects will live (and their classes will be retained and defined in memory) until you finalize that session (SideNail.end())
Also note that SideNail's sessions have nothing to do with your database's sessions. SideNail won't touch them. You still will need to manage them.
Since this software is in an early stage of development User Manual and other documentation is still pending. Nevertheless, examples can be found in SideNail test classes. Class debugging may also help.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.