Commit Graph

  • 6e532a2b37 Update comments. Michael Bayne 2008-04-01 21:40:11 +00:00
  • 3f26158031 Nix @Table, move its fields into @Entity. Michael Bayne 2008-04-01 21:27:20 +00:00
  • 1b5ca78946 Throw a useful error message when we are asked to create a primary key with mixed null and non-null values. Michael Bayne 2008-03-29 23:19:42 +00:00
  • 609e1aff0c Support update partial with a Key<T>. Michael Bayne 2008-03-29 00:32:19 +00:00
  • 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. Par Winzell 2008-03-10 22:28:11 +00:00
  • 2783d31ca2 We need to guard against simultaneous calls to getCache(). Michael Bayne 2008-02-14 18:55:21 +00:00
  • ff165e68a4 Added NotEquals. Michael Bayne 2008-02-12 21:52:44 +00:00
  • da0841c095 None of these constructors actually throw a PersistenceException, so we'll go ahead and not declare that they do. Michael Bayne 2008-02-07 19:59:54 +00:00
  • 4495e56e52 Another type clarification. Michael Bayne 2007-12-17 19:46:28 +00:00
  • 951b201064 Support taking a List as well as a varargs array. There are no doubt other places where this could be done. Michael Bayne 2007-11-26 21:50:54 +00:00
  • 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. Par Winzell 2007-11-18 19:13:39 +00:00
  • 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. Par Winzell 2007-11-11 20:29:38 +00:00
  • f052584607 This is actually starting to look hopeful. We have to add the cache replicator to each cache as we programmatically create them. Make sure we only do so when we have a distributed configuration. Par Winzell 2007-11-11 20:28:10 +00:00
  • 934d7a28be Implement the SQL 'exists' operator. I think this is our first serious subquery clause. Seems to work well. Par Winzell 2007-11-05 16:05:06 +00:00
  • 3789164dae Provide a constructor that takes a collection. Michael Bayne 2007-10-26 23:03:32 +00:00
  • 1dd1b52d3f I made a mistake originally allowing IDENTITY value generators some partial configuration (e.g. start value and increment value). This only ever worked on PostgreSQL, and so would cause completely different behaviour under MySQL. That's obviously a bad idea. Par Winzell 2007-10-18 01:50:11 +00:00
  • 7bb36afef0 Don't assign default values to columns that have a @GeneratedValue annotation because those will have their values set at insertion time and the database might rightly freak out about the inconsistency of saying that the field has a constant default value. Michael Bayne 2007-10-17 00:42:17 +00:00
  • c68068fc33 If the search begins with non-word characters, the array returned by join() will have as its first element. We don't want in the array. So lo, we remove it. Par Winzell 2007-10-15 18:33:21 +00:00
  • f46aaf0152 I was the shadow of the waxwing slain. Par Winzell 2007-10-11 18:49:57 +00:00
  • 85dbdecc0a Oops, haha, this could've been amusing. Par Winzell 2007-10-11 18:31:49 +00:00
  • 5bcfedf044 Match the changes in com.samskivert.jdbc.* by ridding ourselves of static column defining SQL strings. Also give ValueGenerators an option to calculate their initial value based on MAX() of the column for which values are being generated. As part of this we also make sure to initialize new ValueGenerators after all migrations take place, and add a way for them to clean up after themselves as well. Par Winzell 2007-10-11 18:14:49 +00:00
  • 0b31aebb2e Fixed @Transient handling. Michael Bayne 2007-09-27 16:57:05 +00:00
  • 46f0e751f3 Let's not downgrade our databases. Michael Bayne 2007-09-26 21:40:18 +00:00
  • 7fd42bc289 getFullTextIndex() is not expected to return null, so throw an informative exception if it would rather than letting the caller NPE. Also switched to the Zell-style single-letter studly _pClass. Michael Bayne 2007-09-19 17:52:18 +00:00
  • fb5f44b92d We need to look for FTI declarations in superclasses, too, just as we already do with @Entity indexes and @Table unique constraints. Ripped out the pointless RecordMetaData while I was at it. This is a lot cleaner. Par Winzell 2007-09-19 00:13:19 +00:00
  • acab65ac07 Aii, indexes and triggers reside in the database-wide namespace and have to be qualified. I'll need to cook up migrations for the places where we already use FTS... Par Winzell 2007-09-19 00:11:46 +00:00
  • 0c4914db55 Added a standard traverse-and-filter cache invalidator. Michael Bayne 2007-09-18 00:08:32 +00:00
  • f0f722ab7c Ignore @Transient annotated fields when generating persistent field constants. Michael Bayne 2007-09-17 18:23:40 +00:00
  • b2a3cd0f9a Wrapped long lines. Michael Bayne 2007-09-10 20:44:11 +00:00
  • 45a03ed42d Let's note what we're doing here. Par Winzell 2007-08-27 16:22:46 +00:00
  • 8081e7bfad Fall back to the simple case: a query on a concrete record without overrides can be stripped of all JOINs and external WHERE clauses in the second pass. Par Winzell 2007-08-27 16:11:26 +00:00
  • 8e9279c242 We can't replace the original WHERE clause while keeping the original JOINs. Unfortunately, figuring out precisely which JOINs may be safely deleted seems rather complicated. For now, trust the database to do the right thing when our second-pass query is identical to the first one, except with an additional WHERE condition that restricts the primary key columns according to the results of the first pass. Par Winzell 2007-08-24 16:22:27 +00:00
  • d80cccd6bf I'm assuming it's valid for a CachedValue to exist but have a null value as we properly ignore those elsewhere, so we should ignore them when traversing the cache as well. Michael Bayne 2007-08-24 01:46:40 +00:00
  • b24786facd More useful debug information. Michael Bayne 2007-08-24 01:13:27 +00:00
  • cd6410ad7d Let's not stick a fork in things if we don't have to. This is rendering Whirled inoperable right now, but just returning what we got would be perfectly fine. Michael Bayne 2007-08-24 01:07:45 +00:00
  • be3649908b Replace insane implementation with one that does not rely on the database to magically know in which order we want results returned. Par Winzell 2007-08-22 20:30:20 +00:00
  • fa316d40d1 Michael Bayne 2007-08-22 18:19:40 +00:00
  • d652140afb shadowOf is never null, rather it is the default value (PersistentRecord.class) which we should studiously ignore. Michael Bayne 2007-08-22 18:03:44 +00:00
  • 97fed4e7d9 Yet another attempt at glorious audacity, after the realization that different kinds of clauses really do need to handle overrides differently. This should re-enable cache-friendly collection queries even on clones, which are the most complex things we do. Par Winzell 2007-08-22 17:44:06 +00:00
  • 78f6ae51fd Automatically bring any shadowOf class into play without an explicit FromOverride clause. This needs some more thought. Par Winzell 2007-08-22 17:40:48 +00:00
  • b1cdca0595 Even in load() we can be without a where clause, for e.g. loading a count(*) style record. Par Winzell 2007-08-22 17:18:15 +00:00
  • 470c56d38c If we declare an entity-level @Computed(shadowOf=...) then use that class as the default FROM table, duh. Par Winzell 2007-08-22 05:55:57 +00:00
  • a6f5211db4 Hack in a default value for integer types so that Postgres doesn't freak out when we add a new non-null integer column. Maybe we should just specify default values for all our integer columns, but decades of programming history point toward zero as a pretty sensible default. Michael Bayne 2007-08-22 02:40:44 +00:00
  • 5191c6d967 Break a much gentler FieldDefinition out of FieldOverride. The former *must* be supplied for any computed field; the latter must *only* be supplied for fields that would otherwise reference concrete columns. This lets us be more intelligent about what we expand where. Also bring back the old semi-conservative selection criterion for two-pass cache-happy collection queries; it gets simply too hairy when parts of an object's primary key comes from a separate table. Par Winzell 2007-08-21 23:11:14 +00:00
  • 3e96fb1d9a Turn off field overrides when evaluating a join condition. This is all getting hairy -- sometimes you want FooRecord.BAR_C to point to the field 'under' the override, sometimes you want the actual overide expression. Hrm. Michael feels we probably shouldn't do any field expansion magic past the FROM clause. I am hoping we can preserve some of it in some intuitive way. This is a stop gap measure. Par Winzell 2007-08-21 19:06:55 +00:00
  • 0cb937b14b Par Winzell 2007-08-21 15:07:07 +00:00
  • 8e446fe93f Generalize the automatic key value generation code so that it works on any column, and on any number of columns within a record. Par Winzell 2007-08-21 15:02:12 +00:00
  • 60d63b13f1 Let's explain that a bit more hands-on Par Winzell 2007-08-20 18:54:40 +00:00
  • 180b663b73 Fully respect the complexities of persistent records whenever we expand field references in a query. For example, a WHERE clause that operates on a field that's been overridden will correctly use the override. This is much more complicated than what we had before (which was fundamentally broken in its own way) so this patch could introduce strange behaviour. Please be on the lookout for SQL errors in your logs and/or data fields showing unexpected values. Par Winzell 2007-08-20 18:35:43 +00:00
  • 6a608fcd6e Roll back 2192 with comment. Par Winzell 2007-08-17 22:24:37 +00:00
  • fb259504c9 Par Winzell 2007-08-16 20:26:12 +00:00
  • a794805a86 Another place where it's safest to be explicit about whence the column comes. Par Winzell 2007-08-16 20:24:15 +00:00
  • 94766648e6 We have to carefully convert the user's query input to the boolean lexeme language TO_TSQUERY() expects. We may ultimately have to do more complicated things here, too. Par Winzell 2007-08-16 16:54:52 +00:00
  • cf8a977778 Add the primary key on columns, not fields. Par Winzell 2007-08-15 22:18:54 +00:00
  • d414292ac3 Let's not force validation on every Tom, Dick and Harry. This is a little verbose, so maybe I'll change my mind again later and do something yet again different. Michael Bayne 2007-08-15 19:47:16 +00:00
  • a68a6534a4 More sanity checking. Michael Bayne 2007-08-15 19:03:47 +00:00
  • 0175081c54 Michael Bayne 2007-08-15 19:00:50 +00:00
  • 8e13453362 Added some sanity checks to notice and catch programmer errors as early as possible. Michael Bayne 2007-08-15 18:44:35 +00:00
  • b884f89e80 If a persistent record is abstract, do not generate ColumnExp() constants for it; if it extends another record, generate ColumnExp() constants for persistent fields inherited from its parents. Michael Bayne 2007-08-15 02:39:42 +00:00
  • a13756eec3 Make sure the record in question is not computed. Michael Bayne 2007-08-15 01:16:02 +00:00
  • ab8ee79dbe The logging output already contains the enclosing method name. So instead of repeating the method name: Michael Bayne 2007-08-14 23:18:22 +00:00
  • 8e916489e0 Brevify our toString() output so that cache debug logging is readable. Michael Bayne 2007-08-14 23:15:08 +00:00
  • 34d1e73976 Return the string value of our cached value as our own. Michael Bayne 2007-08-14 23:12:53 +00:00
  • 589045232c Add a mechanism for warning about records that are lazily initialized after an attempt has been made to resolve all registered records. Michael Bayne 2007-08-14 21:35:38 +00:00
  • 0b91f0f6a7 Use IllegalArgumentException since those are basically illegal arguments. Also use @exception because it's a nice way to let humans and tools know what's going on. Michael Bayne 2007-08-14 18:47:21 +00:00
  • f9757c3633 "List to Array to List to Set" becomes "to Set". Michael Bayne 2007-08-14 18:37:40 +00:00
  • 4b40140d2d Tighten up a few places where we return null to callers who really never want to see nulls -- throw exceptions instead. Par Winzell 2007-08-14 17:40:00 +00:00
  • 79024ea85a Add dialect-agnostic auto-migration of full text indexes. Par Winzell 2007-08-14 17:00:26 +00:00
  • f80ce4d862 Log the creation of a full text search index on the MySQL side. Par Winzell 2007-08-14 16:09:23 +00:00
  • e5bf0d9d97 Better comments explaining the hairiest bits of auto-migration. Par Winzell 2007-08-14 15:41:36 +00:00
  • 9edfe28d33 Tidied up SQL execution in liaisons; fixed MySQL column renaming. Michael Bayne 2007-08-14 01:11:09 +00:00
  • 3a99decfce Rename @Index(columns) to @Index(fields) and do the proper translation to column name during table creation / migration. Par Winzell 2007-08-13 22:57:09 +00:00
  • 632b8684be Classes go after methods. Michael Bayne 2007-08-13 21:59:25 +00:00
  • d72ad79705 Catch marshaller initialiation failure and report it more informatively. Michael Bayne 2007-08-13 21:47:56 +00:00
  • f76ab3592a More Zell changes: - Re-read the table metadata after we run pre-default migrations, since those are pretty much guaranteed to change the table. - Changed EntityMigration.Rename to a pre-default rather than a post-default migration. - Made all the static EntityMigration subclasses use the generic liaison rather than JDBCUtil. Michael Bayne 2007-08-13 19:42:46 +00:00
  • f4dfccbf97 Patch from Zell to quell warnings about mismatched schemas for database- specific auxiliary columns (specifically Postgres's FTS column). Michael Bayne 2007-08-13 19:37:09 +00:00
  • 9b87020fe5 Added getCacheAdapter(). Michael Bayne 2007-08-11 00:48:59 +00:00
  • f9b6414270 Patch from Zell to properly walk the inheritance tree and aggregate all index-related annotations. Michael Bayne 2007-08-08 23:58:43 +00:00
  • 30681979ea Nixed unused bits. Michael Bayne 2007-08-08 23:49:15 +00:00
  • e21fbd9df1 From Zell: select text and binary column types based on the @Column(length) annotation. Michael Bayne 2007-08-08 23:47:50 +00:00
  • c7150cabdc Small fix from Zell. Michael Bayne 2007-08-07 18:05:49 +00:00
  • eb9c7c9c74 Reinstate automatic schema migration, per Zell. Michael Bayne 2007-08-06 21:52:52 +00:00
  • 8eb5d24be9 Full text index support from Zell, also a fix for deletion. Michael Bayne 2007-07-31 21:36:02 +00:00
  • ddf40eb5c4 Always use an explicit query if we aren't using a cache. Michael Bayne 2007-07-31 02:09:32 +00:00
  • 92c54a5325 Synchronize on the connection while we're using it to cooperate with SimpleRepository + StaticConnectionProvider. Michael Bayne 2007-07-30 20:10:47 +00:00
  • b9d14f57c7 Missed a spot. Michael Bayne 2007-07-26 19:13:57 +00:00
  • 07666e16a6 Added PersistenceContext.shutdown(), exposed shutdown() in ConnectionProvider. Michael Bayne 2007-07-26 19:13:34 +00:00
  • 3628ec528d Zell patch to factor caching code into pluggable CacheAdapter class. Allows us to disable caching and/or replace it with less industrial strength system during development. Michael Bayne 2007-07-26 19:07:20 +00:00
  • cf4f640ab3 Deprecation begone! Michael Bayne 2007-07-25 23:30:07 +00:00
  • 9f544c9174 El Giganto Depot database dialects support from Zell. PostgresSQL here we come. Automatic schema migration is currently disabled and remains to be dialectified. Michael Bayne 2007-07-25 20:53:40 +00:00
  • f0bae6ff8d Header updates. Michael Bayne 2007-07-13 00:20:09 +00:00
  • 68d9be57eb @Override is our friend. It helps to keep us warm and safe. Michael Bayne 2007-07-12 21:50:36 +00:00
  • 083cb788d8 Another Zell Depot patch: - refactoring query construction; - modified collection lookup to first look up the matching primary keys, then check the cache for hits then look up the remainder from the database; - other small renamery and cleanup. Michael Bayne 2007-07-12 20:02:54 +00:00
  • e472fc6de8 Check that our schema does not contain stale columns and issue a warning if it does. Michael Bayne 2007-06-29 00:25:40 +00:00
  • 5b845c0ca7 Michael Bayne 2007-06-18 23:14:26 +00:00
  • 15f3d6be4d Add a delete() that takes a Key. Michael Bayne 2007-06-15 01:13:28 +00:00
  • 41acbbdeca Mark Johnson 2007-06-12 22:30:48 +00:00
  • 2532edba80 We need to initialize migrations here as well. Michael Bayne 2007-06-02 00:07:41 +00:00
  • 9de9835b52 Patch from Zell to fix cache keys. Michael Bayne 2007-06-01 19:53:09 +00:00
  • ffa1f10e6b Oops, we were using _result to pass the record into the modifier in the first place. We'll continue to do that and clear out _result during invoke() which is a wee bit clearer anyway. Michael Bayne 2007-05-23 18:20:08 +00:00