Very important things you should know
Non-transactional databases & Let's Party!
Using a DELETE or UPDATE with Let's Party! could lead to more than one statement issued to the db.
That is, Let's Party! could need to issue more than one statement to do your DELETE/UPDATE, because
it might need to work on multiple partitions of your table. Suppose it has to issue 2 statements to complete
an UPDATE. In case you are not using a transactional system (for example you are using MyISAM tables on MySQL)
and something goes wrong after the first statement (for example, the second one can't be executed because it
throws an exception) your database will be in an non-proper state: the data in the first partition will
be updated, the second will not.
Hence, you should use Let's Party only in one of these cases:
- You are using a transactional database
This way even if Let's Party! is not able to change all the partitions it has to access you can simply rollback the transaction - You are NOT using a transactional database, but you UPDATE and DELETE your data always
using a key that will lead to just one partition of the table (inserts and selects
don't have this problem).
This way Let's Party! will access just one partition for each statement you issue and there will not be any problems.
If you don't use PreparedStatements...
At the moment Let's Party uses the Comparable
interface to do all the comparations
between values. If you declare a partitioned column (example: MY_COL)
of type int (net.sf.letsparty.cfg.IntInterval) and you execute a statement like
select * from MY_PART_TAB where MY_COL=3
Let's Party will throw an exception.
This is because numbers are always parsed as long (in case there is no decimal point,
double otherwise) by the library, and the comparation between a long and an int is
not possible without a conversion. I decided to not doing the conversion because I
believe that PreparedStatements are always to be used (that is, the above statement should be
select * from MY_PART_TAB where MY_COL=?
). In fact, without using a
PreparedStatement, the above statement will have to be re-parsed every time.
MY_COL=3
syntax to be easier to understand:
using the JDBC placeholder (?) would have led to more complicated examples. This doesn't mean
that it is the right way to use the library.