Commit Graph

792 Commits

Author SHA1 Message Date
Michael Bayne ae9e0acef8 We need to let you express whether or not you want your keys from the master
server or if it's OK to get them from a (potentially slightly out of date)
replica. If you're going to modify rows based on the results of findAllKeys(),
you should probably get them from the master server, if you're just reading
data, you can talk to a replica.
2008-09-05 23:03:08 +00:00
Michael Bayne 2e4decf18a Added findAllKeys() for when you only need the keys. 2008-09-05 22:58:05 +00:00
Michael Bayne 95d316d28e One more unused import. 2008-09-05 22:43:38 +00:00
Michael Bayne 709a6ce203 Unused import patrol. 2008-09-05 22:43:06 +00:00
Michael Bayne cd8184f34f Some method ordering. 2008-09-05 22:37:23 +00:00
Michael Bayne fb64881c82 We're handling Key query construction directly instead of letting it look like
a WhereClause, so we need to add our own where.
2008-09-05 22:36:53 +00:00
Michael Bayne 4c41561f0f PrimaryKeySet -> KeySet. 2008-09-05 22:16:55 +00:00
Michael Bayne 249f4a5106 Now we don't have to provide our values as an ArrayList. 2008-09-05 20:07:43 +00:00
Michael Bayne 4bcfda861d Ah, Key actually is PrimaryKey and does not in fact keep the primary key
columns around. Cleaned some things up along those lines.
2008-09-05 20:05:44 +00:00
Michael Bayne 84622e56c7 Formalized the two-phase "get primary keys that match an arbitrary query, then
load or modify the rows that match those keys" pattern so that we can almost
always just magically do the right thing with regard to the cache. Added a
version of deleteAll() that makes use of this.

Also nixed a bunch of checked exception tomfoolery which was almost entirely
unnecessary and now with DatabaseException is completely unnecessary.

A few things remain to be done:

- PrimaryKeySet tries to be "smart" if its passed 0 keys and use
LiteralExp("false") but that causes things to freak out because Depot then
doesn't know what primary class it's dealing with. I'm probably going to make
All and None expressions that match all and none of the records in a table
respectively.

- deleteAll() doesn't currently split its keys into chunks small enough to be
digestible by the database if we match more than 32,768 rows. I'll see if I
can't abstract out that code from FindAllQuery so that we can easily use it
everywhere. It would be cool to handle that a a lower level and allow the
WhereClause to say that it needs to be run in phases, but that would probably
complicate the crap out of the low-level code.

- I need to create PrimaryKey to go between Key and PrimaryKeySet so that we
can avoid duplicating the primary key columns thousands of times in a large
PrimaryKeySet.
2008-09-05 19:39:08 +00:00
Michael Bayne 67bdfda3fe Changed Depot to throw a RuntimeException on unexpected database error instead
of a checked exception. Invariably, we don't do anything with our
PersistenceExceptions except let them percolate all the way to the top and then
log a warning. We can probably automate the process of logging a warning with
useful information and save ourselves the trouble of doing it manually
everywhere.
2008-09-03 16:10:06 +00:00
Michael Bayne 2fd131c0d2 Any collection of anything that extends QueryClause is generally all we need. 2008-09-03 00:55:07 +00:00
Michael Bayne beef018b03 Nixed unused import. 2008-08-25 18:16:35 +00:00
Michael Bayne 43e1a38703 Let's go all the way up to Short.MAX_VALUE. 2008-08-25 16:27:43 +00:00
Michael Bayne d54c633401 Don't try to use an IN() clause with more than 16738 entries. 2008-08-25 15:57:43 +00:00
Michael Bayne 01962836f7 Nixed unneeded log message. 2008-08-20 18:17:52 +00:00
Michael Bayne 8dec5386f2 Don't require a schema version for computed records. 2008-08-20 01:28:31 +00:00
Michael Bayne a670beb665 A couple of changes:
1. Schema version is now always required. The "support" for unversioned schemas
was half-baked anyway.

2. Migration and table creation is now done in such a way that multiple
processes can start up and won't step on one another as they all try to migrate
the same schemas. Instead one will get a lock and do the migration and the
others will patiently wait.
2008-08-20 00:35:12 +00:00
Michael Bayne 64d186d08b Report a better error message if a bogus rename is attempted. Some formatting
cleanup.
2008-08-20 00:22:41 +00:00
Michael Bayne 22fb614f34 Unfiddle long lines. 2008-08-16 20:30:52 +00:00
Par Winzell 338bb62d9f PreparedStatement.setObject() does a lot of runtime type checking, so we don't have to do setShort(), setString(), etc. But we do have to convert ByteEnum's to their byte representation. 2008-08-07 06:02:41 +00:00
Par Winzell 86f3b1e293 The PostgreSQL datatypes for float and double are REAL and DOUBLE PRECISION. 2008-08-07 05:45:25 +00:00
Michael Bayne a48c93be4a From Dave: a bunch of @Override annotating and some other cleanup. 2008-08-06 12:59:06 +00:00
Michael Bayne a0731b34c1 Trimmed trailing whitespace. 2008-08-04 12:37:23 +00:00
Michael Bayne f07694895e Fixed some bogus null checks and assignments. 2008-08-04 00:49:37 +00:00
Michael Bayne 8f2cf98c17 Le metric crapload of generics cleanup. 2008-07-30 13:53:24 +00:00
Michael Bayne 4e002054e4 Unused import pruning. 2008-07-26 20:14:38 +00:00
Par Winzell e3adfea99e Handle SEQUENCE strategies, which are not yet implemented. This'll fix David Hoover's super-strict compilation urges, besides being a generally good idea. 2008-07-21 19:36:47 +00:00
Par Winzell eac0e214ef Always do a (potentially distributed) cache remove on invalidation, regardless of what's in the local cache. From Kyle Sampson. 2008-07-17 12:16:39 +00:00
Ray Greenwell 8f1b3ad8b0 2008-07-15 00:03:10 +00:00
Michael Bayne 33e159047d Use new logging shim. 2008-05-27 18:40:39 +00:00
Ray Greenwell c16003177d 2008-05-19 18:32:58 +00:00
Ray Greenwell 7e93da6fc0 2008-05-16 03:20:27 +00:00
Ray Greenwell 195fabe2cc We need parens so that operators are evaluated in the right order.
This adds extra params around a bunch of things. I'll let the gods of Depot
sort that out.

BTW: Arithmetic.Div is still totally broken. It somehow booches the prepared
statement. I tried changing the operator String to "//" and that sorta worked,
but then the next operator over was missing...
I'm working around this using Mul, but it'd be nice..
2008-05-16 02:10:07 +00:00
Michael Bayne 31b886aed2 2008-04-25 18:32:44 +00:00
Michael Bayne 4eb7d9ecd3 Pass -Dcom.samskivert.jdbc.depot.debug=true to have Depot log queries before
they are executed.
2008-04-23 23:29:07 +00:00
Par Winzell 513ce9aa60 Yank our nomenclature into consistency -- indices, not indexes; fields(), not fieldNames(), as per Ray's suggestion. 2008-04-14 20:18:45 +00:00
Par Winzell 13121249cb The query is in no way guaranteed to uniquely keyed rows, so let's stuff the result into a Set. We should probably add the 'unique' modifier to the actual query, but that requires a bit more cross-dialect-and-version research than I'm willing to give it just now. 2008-04-06 14:57:14 +00:00
Michael Bayne 6e532a2b37 Update comments. 2008-04-01 21:40:11 +00:00
Michael Bayne 3f26158031 Nix @Table, move its fields into @Entity. 2008-04-01 21:27:20 +00:00
Michael Bayne 1b5ca78946 Throw a useful error message when we are asked to create a primary key with
mixed null and non-null values.
2008-03-29 23:19:42 +00:00
Michael Bayne 609e1aff0c Support update partial with a Key<T>. 2008-03-29 00:32:19 +00:00
Par Winzell 7056f6c05c Don't try to build an UPDATE statement at all if no key were set on the record sent into store(). Also throw a sensible (if scaredy-cat) exception rather than an NPE if no WHERE clause were given to an UPDATE. We probably do want to allow rampant nutty 20,000-row UPDATEs at some point, but not because of an accidental null key. 2008-03-10 22:28:11 +00:00
Michael Bayne 2783d31ca2 We need to guard against simultaneous calls to getCache(). 2008-02-14 18:55:21 +00:00
Michael Bayne ff165e68a4 Added NotEquals. 2008-02-12 21:52:44 +00:00
Michael Bayne da0841c095 None of these constructors actually throw a PersistenceException, so we'll go
ahead and not declare that they do.
2008-02-07 19:59:54 +00:00
Michael Bayne 4495e56e52 Another type clarification. 2007-12-17 19:46:28 +00:00
Michael Bayne 951b201064 Support taking a List as well as a varargs array. There are no doubt other
places where this could be done.
2007-11-26 21:50:54 +00:00
Par Winzell d17db31213 Convert nulls to instances of a special NullValue class when we store them, and back again when retrieved. EHCache's replication mechanism flips out if you cache actual nulls (I have no idea why, nulls are obviously serializable). Also fix up some comments -- very soon we are going to have to add better (probably runtime) configurability to the Caches, and probably also write some code to display/collate their statistics. 2007-11-18 19:13:39 +00:00
Par Winzell 8fbdf7470d So while the JRE is happy to serialize arrays, EHCache is reluctant to do so in at least one place (presumably an explicit Serializable test). Let's switch to an ArrayList until further notice. 2007-11-11 20:29:38 +00:00