Quantcast

H2 ARRAY data type and Hibernate

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

H2 ARRAY data type and Hibernate

goodwin@essence.co.uk
I have tested H2 with ARRAY data type to retrieve lots of long float
arrays, and it works fine with JDBC code.

I am now moving to Hibernate, and there doesn;t seem to be any mapping
for the ARRAY data type. What is the best approach? Use raw jdbc for
when I need to access the ARRAY column? What do I map the column to in
the ORM? I am using Netbeans/Visual Paradigm for my development IDE.

To give more background, I have a table which has, say, 5 million
rows, and the ARRAY data type may have up to 500 values for each row.
Retrievable has to be very fast (which it is on my tests using ARRAY
data type). Arrays are Double[].

But - how would it be if I stored the array data as rows in a separate
table? Which might have 2,500 M rows ? How would performance/storage
be affected?

Also, in H2, does the fact that the arrays can be of different lengths
in different rows affect performance/storage? How are they actually
stored? In variable length storage? Or with fixed increments?

But my main issue is how to work with Hibernate and arrays.

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: H2 ARRAY data type and Hibernate

goodwin@essence.co.uk
I guess one option is to have the array data in a separate table with
an ARRAY column and a foreign key, and handle any array manipulation
using SQL rather than hibernate. At least separate out the bad bank
from the good bank.

Retrieval of arrays is frequent and needs to be fast, they are never
updated, and they are inserted fairly infrequently.

On Aug 4, 4:30 pm, "[hidden email]" <[hidden email]>
wrote:

> I have tested H2 with ARRAY data type to retrieve lots of long float
> arrays, and it works fine with JDBC code.
>
> I am now moving to Hibernate, and there doesn;t seem to be any mapping
> for the ARRAY data type. What is the best approach? Use raw jdbc for
> when I need to access the ARRAY column? What do I map the column to in
> the ORM? I am using Netbeans/Visual Paradigm for my development IDE.
>
> To give more background, I have a table which has, say, 5 million
> rows, and the ARRAY data type may have up to 500 values for each row.
> Retrievable has to be very fast (which it is on my tests using ARRAY
> data type). Arrays are Double[].
>
> But - how would it be if I stored the array data as rows in a separate
> table? Which might have 2,500 M rows ? How would performance/storage
> be affected?
>
> Also, in H2, does the fact that the arrays can be of different lengths
> in different rows affect performance/storage? How are they actually
> stored? In variable length storage? Or with fixed increments?
>
> But my main issue is how to work with Hibernate and arrays.

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: H2 ARRAY data type and Hibernate

Kerry Sainsbury
I don't know for sure, but what about mapping the array in Hibernate as SERIALIZABLE ?

On Thu, Aug 5, 2010 at 10:31 AM, [hidden email] <[hidden email]> wrote:
I guess one option is to have the array data in a separate table with
an ARRAY column and a foreign key, and handle any array manipulation
using SQL rather than hibernate. At least separate out the bad bank
from the good bank.

Retrieval of arrays is frequent and needs to be fast, they are never
updated, and they are inserted fairly infrequently.

On Aug 4, 4:30 pm, "[hidden email]" <[hidden email]>
wrote:
> I have tested H2 with ARRAY data type to retrieve lots of long float
> arrays, and it works fine with JDBC code.
>
> I am now moving to Hibernate, and there doesn;t seem to be any mapping
> for the ARRAY data type. What is the best approach? Use raw jdbc for
> when I need to access the ARRAY column? What do I map the column to in
> the ORM? I am using Netbeans/Visual Paradigm for my development IDE.
>
> To give more background, I have a table which has, say, 5 million
> rows, and the ARRAY data type may have up to 500 values for each row.
> Retrievable has to be very fast (which it is on my tests using ARRAY
> data type). Arrays are Double[].
>
> But - how would it be if I stored the array data as rows in a separate
> table? Which might have 2,500 M rows ? How would performance/storage
> be affected?
>
> Also, in H2, does the fact that the arrays can be of different lengths
> in different rows affect performance/storage? How are they actually
> stored? In variable length storage? Or with fixed increments?
>
> But my main issue is how to work with Hibernate and arrays.

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.


--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: H2 ARRAY data type and Hibernate

goodwin@essence.co.uk
I did a google on

array data type hibernate

and found some useful information, mainly wrt Postgres.

But as always there seem to be various options, and I don;t have too
much time to investigate....also new to hibernate as of a few days
ago.

On Aug 4, 11:55 pm, Kerry Sainsbury <[hidden email]> wrote:

> I don't know for sure, but what about mapping the array in Hibernate as
> SERIALIZABLE ?
>
> On Thu, Aug 5, 2010 at 10:31 AM, [hidden email] <
>
>
>
> [hidden email]> wrote:
> > I guess one option is to have the array data in a separate table with
> > an ARRAY column and a foreign key, and handle any array manipulation
> > using SQL rather than hibernate. At least separate out the bad bank
> > from the good bank.
>
> > Retrieval of arrays is frequent and needs to be fast, they are never
> > updated, and they are inserted fairly infrequently.
>
> > On Aug 4, 4:30 pm, "[hidden email]" <[hidden email]>
> > wrote:
> > > I have tested H2 with ARRAY data type to retrieve lots of long float
> > > arrays, and it works fine with JDBC code.
>
> > > I am now moving to Hibernate, and there doesn;t seem to be any mapping
> > > for the ARRAY data type. What is the best approach? Use raw jdbc for
> > > when I need to access the ARRAY column? What do I map the column to in
> > > the ORM? I am using Netbeans/Visual Paradigm for my development IDE.
>
> > > To give more background, I have a table which has, say, 5 million
> > > rows, and the ARRAY data type may have up to 500 values for each row.
> > > Retrievable has to be very fast (which it is on my tests using ARRAY
> > > data type). Arrays are Double[].
>
> > > But - how would it be if I stored the array data as rows in a separate
> > > table? Which might have 2,500 M rows ? How would performance/storage
> > > be affected?
>
> > > Also, in H2, does the fact that the arrays can be of different lengths
> > > in different rows affect performance/storage? How are they actually
> > > stored? In variable length storage? Or with fixed increments?
>
> > > But my main issue is how to work with Hibernate and arrays.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "H2 Database" group.
> > To post to this group, send email to [hidden email].
> > To unsubscribe from this group, send email to
> > [hidden email]<h2-database%2Bunsubscribe@googlegr­oups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/h2-database?hl=en.- Hide quoted text -
>
> - Show quoted text -

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: H2 ARRAY data type and Hibernate

Thomas Mueller-6
Hi,

I would probably avoid using the ARRAY type with Hibernate if you care
about being database independent:

https://forum.hibernate.org/viewtopic.php?t=946973&highlight=postgres+array
(relatively old)

Regards,
Thomas

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.

Loading...