Re: PreparedStatement parameters and mutable objects - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: PreparedStatement parameters and mutable objects
Date
Msg-id 40032351.6030603@opencloud.com
Whole thread Raw
In response to Re: PreparedStatement parameters and mutable objects  (Dave Cramer <pg@fastcrypt.com>)
Responses Re: PreparedStatement parameters and mutable objects
List pgsql-jdbc
Dave Cramer wrote:
> Oliver,
>
> I think finding the "offical" word on this is going to be unlikely, at
> best it will be someone's opinion. It's not in the spec so it will be an
> interpretation. I think more important is meeting the expected behaviour
> from the users POV.

I've sent an email asking for clarification to the feedback address in
the 3.0 specification. Hopefully whatever response I get will make it
into future versions of the JDBC specification.

> That being said, my example showing mutable objects and the expected
> behaviour was just that an example, I think the behaviour should be the
> same for mutable/un-mutable objects. I would expect there would be a
> population of programmers out there that isn't even aware of the fact
> that some objects are un-mutable/mutable. Unfortunately we need to code
> to the lowest common denominator.

Ouch. Pass-by-reference semantics are pretty fundamental to Java. Do we
really have to assume that our users aren't aware of this?

BTW the behaviour for mutable vs. immutable objects *will* be the same
.. it's just that for immutable objects, they don't happen to expose an
interface that allows you to change their value (that's why you call
them immutable ;). The reference semantics are identical.

-O

pgsql-jdbc by date:

Previous
From: Andrew Rawnsley
Date:
Subject: Re: What happens to a ResultSet when statement closed
Next
From: Oliver Jowett
Date:
Subject: Re: PreparedStatement parameters and mutable objects