Using NHibernate with VARRAY

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
stefan.werner
Posts: 2
Joined: Wed 26 Oct 2016 10:17

Using NHibernate with VARRAY

Post by stefan.werner » Wed 26 Oct 2016 10:27

Hello,

I'm trying to use OraceArray / VArray with NHibernate.Fluent mapping.
Based on the http://blog.devart.com/nhibernate_and_oracle.html tutorial I was able to establish the connection to the db and use it with my existing mapping. Only a few mappings e.g.VArray where not working.

How to set my mapping class for NHibernat in order to work this out?
Currently my mapping for the VArray column looks like:

Code: Select all

Map(x => x.PropertyName).Column("COLUMN_NAME")
                .CustomType<SomeTypeRepresentingTheList>()
                .CustomSqlType("VARRAY_TYPE_IN_ORACLE");
The VArray itself is defined by:

Code: Select all

create or replace TYPE "VARRAY_TYPE_IN_ORACLE" AS VARRAY(10) OF NUMBER(9);
By the way, I'm using the latest Version of dotConnect for Oracle: 9.1.131 (20-Oct-2016)


With best regards,
Stefan

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Using NHibernate with VARRAY

Post by Pinturiccio » Fri 28 Oct 2016 13:26

VARRAY is not a simple datatype, like NUMBER or VARCHAR. It is a user defined type (UDT), and ORMs don’t support UDT. Unfortunately, the support of UDT in ORM's is beyond the scope of our support and we cannot provide more information.

stefan.werner
Posts: 2
Joined: Wed 26 Oct 2016 10:17

Re: Using NHibernate with VARRAY

Post by stefan.werner » Fri 28 Oct 2016 15:06

Thanks for the reply, although it's not quite correct. Even NHibernate with the built in oracle driver does support UDT / VARRAY. You only have to implement the UDT type from oracle .net driver.

Anyway, have a nice weekend.

Post Reply