openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick" <michael.d.d...@gmail.com>
Subject Re: [jira] Created: (OPENJPA-740) In MySQL use LONGBLOB, MEDIUMBLOB etc.. when needed, cause BLOB only holds 64kb of data.
Date Mon, 27 Oct 2008 14:30:52 GMT
Hi Simone,

It's probably more than you need, but you can take a look at
TestPrecisionMapping [1] which was added under issue OPENJPA-213 [2].

It works backwards from an entity and determines what type the columns are
mapped to so you'll need an entity which has a blob attribute. AllFieldTypes
[3] or AnnoTest1[4] should work in a pinch though. Let me know if you have
any questions.

-mike

[1]
http://fisheye6.atlassian.com/browse/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/mapping/TestPrecisionMapping.java?r=658197
[2] http://issues.apache.org/jira/browse/OPENJPA-213
[3]
http://fisheye6.atlassian.com/browse/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/AllFieldTypes.java?r=612345
[4]
http://fisheye6.atlassian.com/browse/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/AnnoTest1.java?r=590529



On Mon, Oct 27, 2008 at 9:46 AM, Simone Gianni <simoneg@apache.org> wrote:

> Hi all,
> no one answered so I'm asking again ...
>
> I patched MySQLDictionary to return LONGBLOB etc.. I'd like to test it
> out, but searching in JUnit tests cannot find a test that generates a
> schema and checks it. Can anyone point me to it?
>
> Simone
>
> Michael Dick wrote:
> > Hi Simone,
> >
> > Patch submissions are always welcome :-), but there is a fairly simple
> > workaround.
> >
> > All (or nearly all) the DBDictionary attributes can be changed in your
> > configuration. You should be able to work around this problem by adding
> the
> > following to persistence.xml :
> > <property name="openjpa.jdbc.*DBDictionary*"
> > value="mysql(blobTypeName=MEDIUMBLOB)" />
> >
> > I haven't tested it out, I'll try to take a closer look tonight or
> tomorrow
> > morning.
> >
> > Best Regards,
> >
> > -mike
> >
> > On Tue, Oct 7, 2008 at 5:26 PM, Simone Gianni <simoneg@apache.org>
> wrote:
> >
> >
> >> Hi all,
> >> I can try to patch the code and provide a patch by myself, I'd just like
> >> to know if this bug is "real" or if I'm missing some important
> >> workaround that would make this bug (and the patch) useless.
> >>
> >>
> >> Thanks,
> >> Simone
> >>
> >> Simone Gianni (JIRA) wrote:
> >>
> >>> In MySQL use LONGBLOB, MEDIUMBLOB etc.. when needed, cause BLOB only
> >>>
> >> holds 64kb of data.
> >>
> >>
> ----------------------------------------------------------------------------------------
> >>
> >>>                  Key: OPENJPA-740
> >>>                  URL:
> https://issues.apache.org/jira/browse/OPENJPA-740
> >>>              Project: OpenJPA
> >>>           Issue Type: Improvement
> >>>           Components: sql
> >>>     Affects Versions: 1.2.0
> >>>             Reporter: Simone Gianni
> >>>
> >>>
> >>> When a column is annotated as a BLOB of using @Persistent to use
> >>>
> >> streaming blobs, and the underlying database is MySQL, OpenJPA will
> create a
> >> column of type BLOB. Unfortunately, in MySQL a BLOB column can hold a
> (vary)
> >> limited amount of data, while (especially when using streaming blobs)
> the
> >> user would probably expect it to hold a large amount of data.
> >>
> >>> Also adding the @Column annotation and specifying a size bigger than
> what
> >>>
> >> a BLOB column in MySQL can hold, OpenJPA still creates only a BLOB
> column.
> >>
> >>> I think OpenJPA should be able to create the proper column type
> depending
> >>>
> >> on the @Column annotation if present, or otherwise default at least to a
> >> MEDIUMBLOB to preserve cross-database compatibility as expected.
> >>
> >>> The simplest patch i can think of is setting blobTypeName="MEDIUMBLOB"
> in
> >>>
> >> the MySQLDictionary constructor.
> >>
> >>> Otherwise, overriding the getTypeName to properly parse the length and
> >>>
> >> return the correct BLOB/TEXT type for mysql.
> >>
> >>>
> >> --
> >> Simone Gianni            CEO Semeru s.r.l.           Apache Committer
> >> MALE human being programming a computer   http://www.simonegianni.it/
> >>
> >>
> >>
> >
> >
>
>
> --
> Simone Gianni            CEO Semeru s.r.l.           Apache Committer
> MALE human being programming a computer   http://www.simonegianni.it/
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message