03008f6168
This package no longer needed. Want operator to go away too...
Michael Bayne
2009-09-10 03:24:29 +00:00
4d322fb732
Jihad complete, operators hidden behind the impl veil.
Michael Bayne
2009-09-10 03:22:34 +00:00
3c5b35612c
We're having an existential crisis. There are two exists() methods.
Michael Bayne
2009-09-10 03:15:37 +00:00
ee1ced3f30
Added Ops.exists().
Michael Bayne
2009-09-10 03:05:34 +00:00
7a350474f5
Added exists() as well as a static add() and mul() for times when it seems weird to use those fluently. Might also add div() and sub() but I'm currently wondering why those have varags constructors Div(SQLExpression... values). What does foo / bar / baz mean exactly? That's a rhetorical question, division is left associative, but it's still weird and too non-obvious IMO. foo - bar - baz is also wonky.
Michael Bayne
2009-09-10 02:56:21 +00:00
a6c113e490
Added Ops.like().
Michael Bayne
2009-09-10 02:38:58 +00:00
89a15571ed
Another spot where we need to return non-specific types.
Michael Bayne
2009-09-10 02:23:24 +00:00
a5face282b
Well, OK. We're going to take the pain and break binary compatibility and use thsi opportunity to move a whole heap of stuff into impl that doesn't really need to be visible to external parties. We're changing the return value of all expression creating factory classes to SQLExpression or FluentExp because those expose all the functionality one might need on the returned values and there's otherwise no value to be had getting an And() or a LiteralExp() and a downside of preventing us from replacing the implementation of those expressions without breaking binary compatibility.
Michael Bayne
2009-09-10 02:18:38 +00:00
cf49fbbc9a
Let's switch these to less specific return types before they end up out in the wild.
Michael Bayne
2009-09-10 00:59:15 +00:00
0326468e8e
These need to return FunctionExp to be binary compatible. Let this be a reminder why it can be useful not to return the most specific type possible from a method, but rather a more general supertype that allows us to change the internals of the method without losing binary compatibility.
Michael Bayne
2009-09-10 00:52:23 +00:00
fce9e56aca
Provide these as deprecated for a short while to preserve binary compatibility for Samsara apps.
Michael Bayne
2009-09-10 00:34:08 +00:00
47e6f6f552
Now that we have explicit Ln() and Log10(), let's get rid of the hopelessly esoteric arbitrary-base Log().
Par Winzell
2009-09-09 20:57:08 +00:00
14c1bdd860
Call the convenience collection Funcs, not Funs.
Par Winzell
2009-09-09 20:02:51 +00:00
92fd3054ca
Handle the new Log10 class.
Par Winzell
2009-09-09 19:57:58 +00:00
2ae7d6146b
Unintentional commit.
Par Winzell
2009-09-09 19:56:11 +00:00
12fabe42f7
Actually, that can't happen, so let's handle it more gracelessly.
Par Winzell
2009-09-09 19:55:43 +00:00
27dcb0e753
Eclipse-warning tweaks from Charlie.
Par Winzell
2009-09-09 19:52:56 +00:00
9c68929213
It turns out PostgreSQL supports LN(exp) and LOG(exp) in double precision, but not LOG(base, exp). So we're adding an explicit LOG10. I wonder how useful the two-argument one is... maybe we should delete it.
Par Winzell
2009-09-09 19:51:33 +00:00
32bccc3dd7
Deprecate FunctionExp in favour of explicit support for many common SQL functions, whose convenience factory methods reside in com.samskivert.depot.Funs. The EpochSeconds class is also deprecated in favour of Funs.dateEpoch().
Par Winzell
2009-09-09 14:39:55 +00:00
f871b08383
Tiny typo.
Par Winzell
2009-09-04 21:36:34 +00:00
3032a1e568
Connection.isClosed() is new in 1.6 and Connection.close() is a no-op if the connection is already closed, so let's go for brevity here and save people from having to have 1.6-specific JDBC drivers.
Par Winzell
2009-09-04 19:06:25 +00:00
82d742ec09
A (slightly modified) patch from Charlie to use the magical statement collecting Connection to automatically close all statements created during the course of our operations.
Michael Bayne
2009-09-04 17:37:57 +00:00
52a9c2036f
Charlie's commit patch; if we're not in the auto-commit state, let Depot explicitly commit its operations. If we add transaction awareness to Depot in some future, this behaviour might become more subtle.
Par Winzell
2009-09-03 22:12:44 +00:00
f9eb364c7f
Formatting tidying.
Michael Bayne
2009-08-21 01:50:21 +00:00
157d339906
Provide a generic key element extraction higher-order function that works for any element type at any index.
Michael Bayne
2009-08-20 01:07:57 +00:00
b43ca1e203
We no longer need to export a GWT jar file.
Michael Bayne
2009-08-18 22:07:07 +00:00
928926d5e1
Use ByteEnum from samskivert. This is going to break a bunch of stuff which Ray or I will fix. Whee!
Michael Bayne
2009-08-18 22:04:04 +00:00
c6ae109f19
Some code hygeine from Charlie.
Michael Bayne
2009-08-17 21:06:57 +00:00
1f0c33eacf
Improved error message.
Michael Bayne
2009-08-07 03:11:37 +00:00
363614dff5
Zell may want to refute that this is a good idea, but if I try to order by a computed field in a computed record, Depot freaks out because it doesn't know what table the computed field comes from when it doesn't come from any table.
Michael Bayne
2009-08-07 02:49:20 +00:00
37295dbcb3
Added Exps.count() and Exps.countDistinct() and the necessary plumbing to sneak a 'distinct' into the argument list of the count() invocation.
Michael Bayne
2009-08-07 01:58:58 +00:00
a52abcc7b2
Allow FieldOverride to be constructed with a ColumnExp.
Michael Bayne
2009-08-07 01:36:40 +00:00
0c7a8a5f01
Added sum() and abs().
Michael Bayne
2009-08-07 01:24:10 +00:00
2ee38910c6
Allow a Key<T> to be invalidated directly and create the KeyCacheKey for the caller.
Michael Bayne
2009-07-30 23:23:18 +00:00
e876ff0832
Step one in making Depot's caching classloader friendly: make the keys use only system classes (not 100% done, if you use a ByteEnum in a key right now it doesn't do the right thing). Also moved SimpleCacheKey into impl because it's an implementation detail, not meant to be used by external parties.
Michael Bayne
2009-07-30 22:06:18 +00:00
c0b031a36d
Remove unused imports.
Par Winzell
2009-07-28 16:11:53 +00:00
a64f465990
We need these codes to be consistent across VMs in the cache network.
Michael Bayne
2009-07-17 22:21:11 +00:00
05c9e52bfb
Revamp of cache management. We need our cache adapter to create our caches for us so that if we use multiple PersistenceContexts in the same VM they don't all point to the same cache buckets which causes badness. At some point we'll probably have to make it easier to customize these configurations, but this should work for now.
Michael Bayne
2009-07-17 22:11:06 +00:00
a83bca4bc1
Compromise with Mr Greenwell and provide a Collection which is still somewhat indicative to the caller that they're not just getting another array list back but rather a magical lazily converted list but is more useful than Iterable.
Michael Bayne
2009-07-14 21:15:06 +00:00
4839512173
Trim long line.
Michael Bayne
2009-07-13 06:58:52 +00:00
f44f49aa49
We no longer care about Velocity.
Michael Bayne
2009-07-13 06:58:33 +00:00
fb6d6df3ea
Added Key.toInt() which returns a function that can be used to extract the integer primary key from a Key<T> for records whose primary key is a single integer.
Michael Bayne
2009-07-13 03:09:51 +00:00
8be8037578
Out with commons-io.
Michael Bayne
2009-07-12 21:37:44 +00:00
1daac11a36
We don't really need Velocity here, we just want some simple key/value substitutions. Ditch our dependency on the sometimes fragile and frequently annoying template engine and do things the old fashioned way.
Michael Bayne
2009-07-11 21:35:19 +00:00
c1166e0f4a
Nixed unused import.
Michael Bayne
2009-07-11 21:26:43 +00:00
21ceb241b4
Throw a BuildException if Velocity fails so that we don't write bogus data back out to the source file.
Michael Bayne
2009-07-11 21:26:33 +00:00
bc7a31c661
When we shutdown our EHCacheAdapter, go through and flush everything from memory so that if we turn around and recreate a PersistenceContext with a brand new classloader and start loading things from the cache, we don't have freakoutery because there's a record in memory that was resolved with the old classloader. Plus it allows those old classloaders to get collected.
Michael Bayne
2009-07-10 23:29:36 +00:00
2336246b40
Error message improvement.
Michael Bayne
2009-07-10 22:17:46 +00:00
475e0861af
CountRecord is widely useful. Let's have Depot provide it.
Michael Bayne
2009-07-10 21:47:40 +00:00
9fd87441ac
Added ByteEnumUtil for all your fromByte() needs, included it in the GWT jar in case you need to do it in the land of gwit.
Michael Bayne
2009-07-10 20:37:57 +00:00
9469575ad7
We don't need the fromByte() method, we can just do what the implementation of all of our fromByte() methods already do which is iterate over the Enum and find the one with the right byte. If we care about performance (which we don't because this is trivial since all of these enums are small), we could even cache a mapping from byte to enum in the field marshaller. No need to foist this reponsibility on the ByteEnum implementor.
Michael Bayne
2009-07-10 17:20:57 +00:00
def3d652ad
Beans/frank.
Michael Bayne
2009-07-10 03:28:02 +00:00
4b4ff40ee5
We need to allow persistent fields to not exist for longer because we may be using magical methods to convert to/from composite runtime fields.
Michael Bayne
2009-07-10 00:05:37 +00:00
65f4c8dff4
This is possibly getting a little too jiggy, but I'm having all Depot methods that return a collection return an XList which extends List and adds the method:
Michael Bayne
2009-07-09 20:02:00 +00:00
4c697b06a4
Allow a null persistent record to be tranformed to a null runtime record, and fail immediately when trying to transform a null runtime record to a persistent record.
Michael Bayne
2009-07-09 19:50:22 +00:00
7dd164525b
More magic! We now automatically convert between java.sql.Timestamp, java.sql.Date and java.util.Date and we support custom getters and setters to do fancier aggregate conversion (multiple persistent fields into a single runtime field and/or creation of partially initialized runtime objects from the available persistent data).
Michael Bayne
2009-07-08 22:10:07 +00:00
a113b5d85b
We only want non-static, public fields.
Michael Bayne
2009-07-06 21:55:31 +00:00
6ca5f2e4e7
Utilities for creating magical mapping functions that use reflection.
Michael Bayne
2009-07-06 21:41:29 +00:00
c0eab0a4c3
Bye bye old adaptation.
Michael Bayne
2009-07-06 16:53:16 +00:00
858bf4ab1c
Allow shutdown() to NOOP if we were never init()ed.
Michael Bayne
2009-07-04 18:39:02 +00:00
b8696e0060
Added like().
Michael Bayne
2009-06-11 17:49:43 +00:00
d91f968062
Let's not be grouchy about this. Empty ins are probably uncommon and it's foolish to complicate a bunch of client code. Either we'll do some magical optimization on the Depot side and not even send queries to the server that we know can't match anything, or we'll just suck it up and occasionally send a query to the database that we know will match no rows. C'est la vie.
Michael Bayne
2009-06-10 21:52:55 +00:00
b3ee76f914
Added FooRecord.FOO_ID.join(BarRecord.FOO_ID).
Michael Bayne
2009-06-10 21:07:07 +00:00
1e5c201501
Javadocs.
Michael Bayne
2009-06-10 20:59:34 +00:00
6d520a33d6
Oops, those should be static.
Michael Bayne
2009-06-10 20:58:55 +00:00
f57795c48f
More import relief: add builder classes Ops and Exps which have methods for creating common operators and expressions that don't fit nicely into the fluent style. For example: Ops.and(expr1, expr2) is preferable to expr1.and(expr2) and Ops.not(expr) is definitely nicer than expr.not() (which we don't even provide).
Michael Bayne
2009-06-10 20:58:12 +00:00
03ac710d4f
Yet more fluency.
Michael Bayne
2009-06-10 18:39:56 +00:00
3cc29e08b9
More fluency.
Michael Bayne
2009-06-10 18:37:28 +00:00
d4a376e78b
FluentExpression -> FluentExp, made a few other base expressions fluent.
Michael Bayne
2009-06-10 18:35:07 +00:00
d1e8ed43e2
Added in().
Michael Bayne
2009-06-10 17:42:52 +00:00
c8417a366e
Added bitAnd and bitOr.
Michael Bayne
2009-06-10 17:29:16 +00:00
12e612fe34
OMG I can't believe I didn't think of this earlier: provide fluent builder methods for expressions. Now you can do FooRecord.BAR.eq(5) instead of new Equals(FootRecord.BAR, 5), which also saves you the Equals import. Added methods for operators, some are probably missing and some don't make sense. I'll fill this out more as I discover where else this style is useful.
Michael Bayne
2009-06-10 17:27:10 +00:00
b029dfd6cd
Javadoc and import cleanup.
Michael Bayne
2009-06-10 17:20:31 +00:00
fce2c05f9b
So, milli/nano is 1E6, not 1E3, thanks Ray.
Par Winzell
2009-06-03 18:49:45 +00:00
bde9404ca5
Oh Java, I do wish that Map.get() took K not Object.
Michael Bayne
2009-05-29 23:43:50 +00:00
83a4149cbf
Fix array indexing booches.
Michael Bayne
2009-05-29 23:15:04 +00:00
79c6f364fa
Javadoc and variable naming improvements.
Michael Bayne
2009-05-29 22:24:58 +00:00
a8da0d960f
Those need to be Object because they could be (probably are in fact) SQLExpression instances.
Michael Bayne
2009-05-29 22:16:37 +00:00
c46741cbe2
Let's make the varargs version of updatePartial a little safer by requiring a typed (ColumnExp, Comparable) as our first pair of arguments and only let you get jiggy after that.
Michael Bayne
2009-05-29 22:14:19 +00:00
3062afe1b5
updateLiteral -> updatePartial. It's all partial updates now and you can either pass in a map or use the varargs methods.
Michael Bayne
2009-05-29 21:54:12 +00:00
962a9cfb5a
No String[]. Use ColumnExp[] all the way down. Now that things are getting tidier, it's a shame that ColumnExp is named as it is because really it's a FieldExp as it represents the name of the Java object field, not the actual name of the column which may be something different (if you use @Column(name="foo")). Maybe next time.
Michael Bayne
2009-05-29 21:40:17 +00:00
08122cda8b
Nixed a bit more unneeded parameterized typing.
Michael Bayne
2009-05-29 21:04:26 +00:00
cc961d14e2
Consolidated some duplicated update-related code in DepotMarshaller, nixed some unneeded type parameterization.
Michael Bayne
2009-05-29 21:00:33 +00:00
04d7fedb92
Boop boop. Final methods with Comparable<?> nixed. The javadocs for DepotRepository are looking positively svelt and comprehensible.
Michael Bayne
2009-05-29 19:12:44 +00:00
2b847056bf
More strictness. Have to use a key to load individual records. Again this is just as succinct, but type safer:
Michael Bayne
2009-05-29 18:36:25 +00:00
f052bba59d
Nix obsolete cache documentation. The enum is pretty self documenting.
Michael Bayne
2009-05-29 00:13:07 +00:00
4b6dc9f5c7
Nix a bunch of untyped methods in favor of just a version that takes Key. It's only one character more to type FooRecord.getKey(someId) than to type FooRecord.class, someId and with the new Key.newKey() methods, you can also create ad hoc keys briefly when needed.
Michael Bayne
2009-05-29 00:11:53 +00:00
1b6c3752df
Helpy helper functions!
Michael Bayne
2009-05-28 22:55:23 +00:00
bde87ac0e6
Added support for intervals which would almost be exactly the same except that Postgres insists that you quote: interval '7 day' and MySQL insists that you not quote: interval 7 day. Frawesome!
Michael Bayne
2009-05-28 22:53:30 +00:00
965cd7fd60
Unused import nixy.
Michael Bayne
2009-05-28 21:29:58 +00:00
5f6e4f80b4
We were one variation short.
Michael Bayne
2009-05-28 21:29:51 +00:00
ed6eaae7b7
This is going to break everything, but I couldn't stand our operator inner classes any more, so I promoted them all to standalone classes.
Michael Bayne
2009-05-27 23:30:19 +00:00
601b9eaba1
Sanity checking makes for more sanity.
Michael Bayne
2009-05-27 22:26:47 +00:00
c8e5a3b413
Covariance here makes it easier to use ImmutableMap.
Michael Bayne
2009-05-27 17:35:04 +00:00
a765645307
We don't really need to hear stats on shutdown.
Michael Bayne
2009-05-19 06:01:50 +00:00
636e2d7046
Factored out metadata handling into separate class. Modified repository initialization to not hit the database at all in the up-to-date case (after a single query to load the versions of all known records). This is about six hundred fewer queries than we were doing on Whirled at server startup. To be fair, they were pretty fast queries. :)
Michael Bayne
2009-05-19 05:30:47 +00:00
8b202f530e
More fluency.
Michael Bayne
2009-05-11 19:30:25 +00:00
dec7482c1b
Using Timestamp as a primary key? omg cray-z.
Michael Bayne
2009-05-01 16:48:38 +00:00
78c5a458de
Get rid of one trailing space. :)
Par Winzell
2009-04-29 18:56:05 +00:00