Commit Graph

731 Commits

Author SHA1 Message Date
Michael Bayne 90d01ce58d Revamp stock marshaller creation, use to further optimize @Transform search. 2012-04-13 16:00:51 +00:00
Michael Bayne 6d8eabce93 Improve the semantics of @Transform handling.
@Transform is first sought on the field itself, which overrides any other
handling. Next it is sought on the class that represents the field (i.e. if the
field is type Foo we look for an @Transform annotation on class Foo). We avoid
doing this somewhat expensive search if the field has a type that we know
cannot have an @Transform annotation. If we've still found no @Transform
annotation (which is unfortunately the overwhelmingly common case), we then
create a stock marshaller.
2012-04-13 16:00:46 +00:00
Michael Bayne 946f05d3a0 Resolve our migration record during initRepos.
Otherwise, if a data migration is registered and run after the initialization
process, we'll end up warning that this record has not yet been initialized.

In theory, you should register your data migrations prior to calling initRepos,
but I don't want to be too draconian about that. Unlike schema migrations, you
*could* conceivably mean to start your app up and let it run before running
data migrations.
2012-04-05 22:21:37 +00:00
Michael Bayne 5984dbba80 Make it possible to register migrations outside a repository. 2012-04-04 18:46:46 +00:00
Par Winzell 73346e9fd0 Add the actual Distinct class; fix bugs. 2012-02-03 21:39:12 +00:00
Par Winzell cf47c335a0 Implement SELECT DISTINCT [ON <exp>] as a QueryClause. 2012-02-03 21:29:16 +00:00
Michael Bayne 03ee53194b Oops, ended up passing that to the ctor rather than a toggly method. 2012-02-02 18:30:56 +00:00
Michael Bayne 020e7911ba Added support for disabling schema migrations for a PersistenceContext.
This allows two separate services which share a database to assign "control" of
the schema to one of the services. The non-controlling service can be
configured to simply fail if new code is deployed to said service before new
code is deployed to the controlling service, rather than have the
non-controlling service migrate the schema out from under the controlling
service.
2012-02-02 18:27:58 +00:00
Michael Bayne 2d998ac23a As Jamie points out, we should use pe as the cause, rather than writing them
out of the (chain of exception) inheritance.
2012-01-14 02:39:33 +00:00
Michael Bayne dbf0684567 If we're creating a table the first time, note that we now expect the current
version to be 0, not -1.
2012-01-13 18:35:29 +00:00
Michael Bayne 55a866842b Report the identity of the connection we're trying to establish.
This is more useful than parroting the lower level exception message, which
will already be shown in the full stack dump anyway.
2012-01-13 17:15:10 +00:00
Ray Greenwell fa66796863 When grabbing the schema migration lock, ensure that the current
version is set to what we expect it to be.

Otherwise if one node reads an old value for the schema version, it will
be able to grab the migration lock as long as another node has already
completed the migration.
2012-01-05 20:35:55 +00:00
Ray Greenwell 73c111c20b Update to Guava 11, change MapMaker/ConcurrentMap -> CacheBuilder/LoadingCache. 2012-01-05 20:34:14 +00:00
Ray Greenwell 9838e4922c Added OrderBy.Order.NULL.
"order by null" can be used in a query with a "group by" in it to tell
the database to suppress the overhead of sorting the results.
(Supported in postgres and mysql.)

Changed the build visitors to have a whitelist of supported
Orders, and to NPE on a null value for the Order enum.

Note that previously "order by null" could be accomplished by passing
a null value to your OrderBy, but now the enum constant must be used.
I can change that if this disrupts anything.
2011-12-06 19:26:53 +00:00
Ray Greenwell acbdfc4044 Added two new Order constants: ASC_NULLS_FIRST and DESC_NULLS_LAST.
Only supported on postgres. If needed we could allow for fallbacks
for other databases.
2011-12-03 22:06:08 +00:00
Michael Bayne fb0a5f2884 Improve the documentation here. 2011-11-23 03:06:14 +00:00
Michael Bayne 33615067d9 Fail early. 2011-10-24 21:13:25 +00:00
Michael Bayne 3fbd5f4993 Made log message less terrifying.
I don't like to see the words "Aborting creation." when I'm in the middle of
creating databases. If we're not creating the index, fine, but don't give me
the idea that we're aborting the entire creation of the table.
2011-10-20 20:10:59 +00:00
Par Winzell 710d2ffaf2 From Bruno Garcia: Add a mode for FullText to search for rows that match all the words in a query rather than any of them. 2011-08-24 15:04:43 +00:00
Dave Hoover 27f33b8d90 Don't need that semicolon. 2011-07-01 18:11:11 +00:00
Michael Bayne 3f8f15af9f Added support for clearing caches. 2011-06-27 21:08:01 +00:00
Ray Greenwell c26d9b29fb Had this laying around...
- Added an IntegerIterable Transformer.
- Document that these *Iterable transformers work with List/Set/Collection...
  In case it wasn't clear.
- Added a sizeHint argument to the createCollectionBuilder method, take
  advantage of that in the IntegerIterable since we don't need to do any
  work to find the size.
2011-06-24 20:17:02 +00:00
Charlie Groves cef1461109 Warning cleanup 2011-06-24 19:47:18 +00:00
Charlie Groves 7ba475e61c Use default values for the values section of an insert statement for hsqldb as well as postgres
It blows up expecting a column name in the values parenthesis, but the default values string that
postgres was working seems to work. It's not in http://hsqldb.org/doc/guide/ch09.html, but so it
goes.
2011-06-24 19:25:57 +00:00
Charlie Groves a28990116c Some test cleanup from Eclipse 2011-06-24 19:22:24 +00:00
Michael Bayne e3ff96745d Added support for limit to deleteAll.
I would have prefered to only add this support to the Query interface, and not
clutter up DepotRepository with two additional overloaded methods. However,
that would not have been possible without duplicating a bunch of logic from
DepotRepository. Yet another reason why the Query builder approach is awesome
and the fuckloads of overloaded methods approach isn't.
2011-06-23 22:12:47 +00:00
Ray Greenwell eb6d48d054 Changed selectCount() to not alter the state of the Query,
so that I can select a count of matching rows and then go on
to add an ordering and limit and select a particular page of results.
2011-05-13 16:43:31 +00:00
Andrzej Kapolka 5d9a584e4c Because MySQL can't abide parentheses around its intervals, let's put
them around the entire expression rather than around the operands
(which matches the behavior of the binary operator method).
2011-05-12 01:48:24 +00:00
Michael Bayne 607f63a7a1 Fixed a problem where the Postgres JDBC driver would call toString() on an
enum, when we need it to be using name() instead. We just take care to send it
the results of name() instead of the enum value itself.

It would be nice to share this code with BuildVisitor.bindValue, but that would
require yet further twisting and factoring of the code, obscuring it even more.
We'll just hope that special cases like Enum and ByteEnum aren't going to keep
cropping up.
2011-05-05 19:02:38 +00:00
Michael Bayne fe028a1e42 Override toString in the enum we use for testing, to be sure we don't rely on
it in our internals. We actually do use the toString value, but only in
constructing the cache key for a query, which should generally not result in
badness, unless you override your enums to not return unique strings for
different enum values.

It's looking like the Postgres4 driver calls createArray with an Object[] full
of enums, and it calls toString on the values in the array. I have an idea for
how to fix that, which is coming up next.
2011-05-05 18:56:39 +00:00
Michael Bayne 4c1864ddd6 This is exactly the sort of place where it's useful to *not* turn a complex
value into a string and then throw it away when doing debug logging.
2011-05-05 18:56:33 +00:00
Michael Bayne e53288b7c4 Compactified header, extracted copyright and license bits into LICENSE. 2011-05-05 18:35:14 +00:00
Michael Bayne 72c4782b3c We need to quote identifiers in MySQL so that we can handle columns with names
like group.
2011-05-04 18:40:24 +00:00
Michael Bayne fd4be08c78 None would be best in this case. 2011-04-30 23:21:35 +00:00
Andrzej Kapolka 531b9a3234 Some changes to allow the ability to subclass the stats class and
record more extensive, per-table stats.
2011-04-01 04:44:04 +00:00
Charlie Groves e41e3c9961 Match the SQLBuilder changes in HSQLBuilder to fix the build 2011-03-29 19:36:35 +00:00
Ray Greenwell 903bb5181b From Mark Johnson: support long autogenerated fields. 2011-03-29 03:42:24 +00:00
Ray Greenwell 07e5b934b5 Patch from Mark Johnson: support long[] field types. 2011-03-29 01:52:59 +00:00
Charlie Groves 7129295906 Updates from running genrecord 2011-03-23 20:42:45 +00:00
Charlie Groves 1a2967b31f yohoho no longer cares if depot is built with 1.6, so build with that since we're using 1.6's Connection.createArrayOf in PostgreSQL4Builder. Sneak a ooo-buildification in with the compiler version bump. 2011-03-23 20:42:00 +00:00
Charlie Groves 1be9961245 Crap, missed a few 2011-03-23 01:44:48 +00:00
Charlie Groves 2dbfaa0ee6 Remove an @Override from an interface as that isn't 1.5 compatible, and remove some unused imports 2011-03-23 01:43:52 +00:00
Michael Bayne ad4f2c9970 Changed expressions that deal with count() results to Number because Postgres
in its burning desire to support the amazing four hundred billion rows, returns
a Long for count expressions.

Clients using selectCount() won't be impacted, but clients doing more complex
counting are going to have to sprinkle in some .intValue() calls.
2011-02-28 22:58:38 +00:00
Michael Bayne 677de3da03 Added notNull() at Ray's request. 2011-02-28 19:12:52 +00:00
Andrzej Kapolka 89927523bc Let byte enum columns be nullable. 2011-02-21 20:58:34 +00:00
Michael Bayne 86476b4494 Now that we accept a list of SQL statements to be executed individually (and
committed after each statement), I no longer need to manually handle table
population.
2011-02-18 18:25:34 +00:00
Michael Bayne 687de42168 Added needed import. 2011-02-18 18:24:40 +00:00
Michael Bayne 8499fc1c06 Implemented a framework for testing database migrations. Unfortunately, I am
not filled with ideas on how to programmatically verify that the primary key
migration I've just created a test for is actually working. I can visually
inspect the logging output, but that's not useful for catching potential future
regressions.
2011-02-18 01:53:38 +00:00
Michael Bayne 62fb0eac99 Allow a name and a series of initialization statements to be provided when
creating a persistence context.
2011-02-18 01:53:30 +00:00
Michael Bayne 2565a292d1 Have the trivial fetcher do no stats updating by default. 2011-02-18 01:53:23 +00:00