Commit Graph

997 Commits

Author SHA1 Message Date
Michael Bayne b4051ef67e Whoops, we want declared fields for generating the constants but all fields for
determining the public key. As always, the plot is thicker.
2007-04-19 21:25:45 +00:00
Michael Bayne fce254db55 Let's put that check in the right place. 2007-04-19 21:21:49 +00:00
Michael Bayne 5e7d5e9df4 Three things:
- don't try to generate getKey() for abstract classes;
- get all of our class's fields, not just the ones declared in this class; do
  so using ClassUtil.getFields() rather than Class.getFields() because the
  latter returns the fields in a random order which is annoying whereas
  ClassUtil.getFields() returns them in an intuitive order (declaration order
  of the super-most class, then declaration order of the first derived class
  and so on);
- use Field.getAnnotations() rather than Field.getDeclaredAnnotations() just
  for consistency, even though you can't "override" a field and inherit
  annotations from your parent class (but if someday we have annotated
  PersistentRecord methods we'll want to use getAnnotations() not
  getDeclaredAnnotations() so we should provide appropriate copy and paste
  fodder).
2007-04-19 21:16:50 +00:00
Michael Bayne 420509be8d Introspection is expensive and the number of persistent classes is small, so
we'll cache the introspected primary key fields and reuse them. This has the
added benefit that we can eliminate storing the key fields entirely because we
know they must be exactly the set of primary key fields for the object which
never changes.

We will have to ensure that we flush our caches whenever we do a new release,
but we would have to do that anyway for a variety of reasons. Actually, we
could perhaps make use of the persistent object's versions and note the version
number of the cached instances in the cache and ignore the cache if they
differ.
2007-04-17 18:09:42 +00:00
Michael Bayne 2d9e812e65 Oops, forgot to strip whitespace from blank lines. 2007-04-17 17:44:41 +00:00
Michael Bayne e3e515b087 Patch from Zell to ensure that Key objects are only constructed with primary
key fields and also don't leave any out.
2007-04-17 17:42:56 +00:00
Michael Bayne 41d75ff59b Generate getKey() methods for our PersistentRecord classes in addition to
adding the field/column constants. Moved some of GenUtil into samskivert in the
process.
2007-03-16 20:50:10 +00:00
Michael Bayne 02de60a49d Improved @Computed support for subset record queries, from Zell. 2007-03-16 00:21:27 +00:00
Michael Bayne bd1359e7bb Return whether we updated or inserted. 2007-03-02 04:36:04 +00:00
Michael Bayne 9e42f3b319 When we create a table for a persistent record, set the starting version to the
correct value to avoid spuriously trying to migrate it immediately thereafter.
2007-03-01 23:43:21 +00:00
Michael Bayne 9c5765c38d This should really be automagic but for now we'll have a manual migration. 2007-02-28 00:25:43 +00:00
Michael Bayne 39a4d5463f 2007-02-20 19:14:21 +00:00
Michael Bayne 2daf15da71 Do that more nicely. 2007-02-20 19:12:30 +00:00
Michael Bayne 9556b9b0a2 Stop if we get to a generic type declaration. 2007-02-20 19:09:13 +00:00
Michael Bayne 3277012a55 Behold, a column identifier generator for our keystroke saving needs. 2007-02-20 18:52:28 +00:00
Michael Bayne 2896b256ec Do the same magic for DATETIME that we do when adding a TIMESTAMP column. 2007-02-20 02:17:56 +00:00
Michael Bayne 7fa2a1a2b8 Expanded convenience methods, from Zell. 2007-02-20 00:12:06 +00:00
Michael Bayne 3dc159b59b Why fail when we can just complain without loss of integrity. 2007-02-19 19:47:18 +00:00
Michael Bayne 853c6f8b81 Cache invalidation patch from Zell. 2007-02-19 19:30:48 +00:00
Michael Bayne 2bc9c26119 Only log one line and don't create a Statement and then decide not to use it
because the migration has already been performed.
2007-02-18 21:43:08 +00:00
Michael Bayne 84c842aeeb More informative error message. 2007-02-18 21:41:20 +00:00
Michael Bayne 0a3ac07001 Make drop migrations idempotent. 2007-02-18 21:40:13 +00:00
Michael Bayne be56250d8e >= and <= operators. 2007-02-10 19:04:36 +00:00
Michael Bayne 5b9f06f933 Make our Rename migration more lenient about having already been performed. 2007-02-09 20:41:30 +00:00
Michael Bayne 4df78e2e08 Added a Like operator courtesy of Mr Winzell. 2007-01-31 18:34:45 +00:00
Michael Bayne 916dfb3cfa 2007-01-30 22:40:24 +00:00
Michael Bayne d6156c201a Patch from Zell to fix index bits. 2007-01-30 20:57:38 +00:00
Michael Bayne 0a3bcdbfcc Two operators from Zell. 2007-01-19 00:01:16 +00:00
Michael Bayne f7caf53511 Type safety and varargs don't play nicely together. Funny that it only freaks
out when you try to compile code that calls a varargs method with more than one
class. At that point it tries to create an array with a generic element type
which is disallowed.
2007-01-16 05:33:58 +00:00
Michael Bayne 180e4626c1 Modifications to clone() on insertion and extraction from cache, from Zell. A
whole bunch of type safety jockeying and concretification of QueryClause by
yours truly.
2007-01-16 05:30:02 +00:00
Michael Bayne 4f6a334018 @Table(uniqueConstraints) support from Zell. 2007-01-15 01:57:35 +00:00
Michael Bayne 935bd34621 Some fixes and documentation from Zell. 2007-01-14 20:40:54 +00:00
Michael Bayne 8f4b37d9dc Caching support from Zell. Hard drives the world round rejoice! 2007-01-11 00:43:08 +00:00
Michael Bayne 58439d0285 Collections are a goodness. 2007-01-08 21:16:33 +00:00
Michael Bayne 2c54bc97c9 Don't auto-remove indices either. Deciphering whether that's the right thing to
do is a PITA and not really worth the trouble.
2007-01-02 22:12:05 +00:00
Michael Bayne ea85c1d500 Missed a space. 2006-12-24 01:30:44 +00:00
Michael Bayne 0235cd80ac The plot thickens. Support all the varieties of modes with or without query
expansion.
2006-12-22 00:34:45 +00:00
Michael Bayne 679a762247 Support different query modes. 2006-12-22 00:30:20 +00:00
Michael Bayne 20c6e167e1 Them thar columns was all jammed together. Give 'em some breathin' room with
commas.
2006-12-22 00:06:45 +00:00
Michael Bayne fce4c8af63 Added Conditionals.Match for MySQL full text query operator. 2006-12-21 23:33:37 +00:00
Michael Bayne b071e8449d Nix auto-column dropping, add simple concrete migrations that can be used to
easily register a column drop or a column rename should the need arise.
2006-12-21 22:55:27 +00:00
Michael Bayne 358d74325c Automatically add and remove indices and primary key (though it's extremely
unlikely that one would do the latter), automatically remove obsolete columns
(might be dangerous, I could be pursuaded to reconsider).
2006-12-21 22:34:06 +00:00
Michael Bayne b1ed8b0211 Index handling. Automatic addition and removal of indices not yet implemented. 2006-12-21 20:53:55 +00:00
Michael Bayne d9a5cdaec8 Added support for hand-registered migrations (untested). 2006-12-21 19:06:18 +00:00
Michael Bayne 79c8d020c3 Added Entity.postamble, wired it and Entity.name up properly. 2006-12-21 18:06:59 +00:00
Michael Bayne f3a14252ed TableKeyGenerator was not using the annotation specified initial value. 2006-12-20 21:51:46 +00:00
Michael Bayne e494281ea1 No need to require a concrete map class. 2006-12-20 19:33:53 +00:00
Michael Bayne 9d7eda16f9 Added a version of updatePartial() that takes a Map of keys and values which it
converts to a list and calls the existing version.
2006-12-20 19:31:46 +00:00
Michael Bayne cf15c7c998 Support for more operators and functions from Zell. 2006-12-15 23:08:26 +00:00
Michael Bayne d06b9685dc Add some hackery to work around MySQL's strange habit of assigning 0 instead of
the current time when adding a TIMESTAMP column to a table (even if you
explicitly define the TIMESTAMP column with DEFAULT CURRENT_TIMESTAMP).
2006-12-11 21:35:05 +00:00