Skip site navigation (1) Skip section navigation (2)

Re: Problems with Hibernate Discriminators and 9.0-801.jdbc4

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Lew <noone(at)lewscanon(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Problems with Hibernate Discriminators and 9.0-801.jdbc4
Date: 2011-03-28 14:08:04
Message-ID: AANLkTimMUMLAwpD-hy0vy+02xJcGHhuY16HOA8cMoi72@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
On Mon, Mar 28, 2011 at 9:27 AM, Lew <noone(at)lewscanon(dot)com> wrote:
> Chris Wareham wrote:
>>
>> Dave Cramer wrote:
>>>
>>> Ok, looking at the hibernate source this is what is in the
>>> PostgreSQLDialect
>>>
>>> public String getIdentitySelectString(String table, String column, int
>>> type) {
>>>  return new StringBuffer().append("select currval('")
>>>    .append(table)
>>>    .append('_')
>>>    .append(column)
>>>    .append("_seq')")
>>>    .toString();
>>>  }
>>> }
>
>> Just as an aside, should that not be using a StringBuilder rather than
>> a StringBuffer? Or does Hibernate still explicitly support Java 1.4?
>
> My Red-Flag-O-Meter triggered on that, too.  What Hibernate ought to do is:
>
>  return "select currval('" + table + '_' + column + "_seq')";
>
> for Pete's sake.


Really ??? the last time I checked the above will generate approx 5
objects StringBuffer.append is the recommended use for java 1.4,
StringBuilder is only marginally faster as it not synchronized.

+ or concat is much slower as it creates a new object each time and
copies the old into the new.


Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca

In response to

Responses

pgsql-jdbc by date

Next:From: Віталій ТимчишинDate: 2011-03-28 14:31:19
Subject: Re: Problems with Hibernate Discriminators and 9.0-801.jdbc4
Previous:From: Dave CramerDate: 2011-03-28 13:40:53
Subject: Re: Problems with Hibernate Discriminators and 9.0-801.jdbc4

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group