We're updating the issue view to help you get more done. 

SpatialDialectFactory overwrites custom Dialect

Description

It is very cumbersome to use custom dialects which are extending OracleSpatial10gDialect. Consider MyOracleSpatial10gDialect as a sub-class of OracleSpatial10gDialect.

1 2 3 4 5 6 public class MyOracleSpatial10gDialect extends OracleSpatial10gDialect { public MyOracleSpatial10gDialect() { super(); registerHibernateType(Types.ARRAY, "array"); } }

Due to the nature of buildDialect() in the SpatialDialectFactory, MyOracleSpatial10gDialect will pass the test if (dialect instanceof OracleSpatial10gDialect) which will result in a new object of the parent class OracleSpatial10gDialect. This is bad. This way all custom attributes, like additional type mappings, of MyOracleSpatial10gDialect "get lost".

In my persistence unit I specify this custom dialect which is used correctly:

1 <property name="hibernate.dialect" value="foo.bar.MyOracleSpatial10gDialect"/>

But during initialisation then, the SpatialDialectFactory destroys my dream.

Environment

Java 1.8 x64, Oracle 12

Status

Assignee

Karel Maesen

Reporter

MichaelS

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Time Tracking

2h

Components

Affects versions

5.0.5

Priority

Major