Grails

Add columnDefinition (or sqlType) to GORM DSL

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.0.4
  • Component/s: None
  • Labels:
    None

Description

RE: http://www.nabble.com/GORM-DSL-columnDefinition-or-sql-type--td18245961.html

Add the option to set the columnDefinition (sql-type) in the GORM DSL.

Something like this:

static mapping = {
columns { location type:org.hibernatespatial.GeometryUserType, columnDefinition:'GEOMETRY' }
}

This is called columnDefinition in JPA and sql-type in hibernate xml and a separate option from specifying 'type' that allows you to force the sql column definition when dialect mapping is insufficient.

For example,

<property name="location" type="org.hibernatespatial.GeometryUserType" >
<column name="LOC" sql-type="GEOMETRY"/>
</property>

and the equivalent annonations are:

@Column(name="LOC",columnDefinition="GEOMETRY")
@Type(type="org.hibernatespatial.GeometryUserType")
public Point getLocation(){...}

FYI more on this example of when its necessary :
http://www.nabble.com/No-Dialect-mapping-for-JDBC-type%3A-2003-td15459772.html#a15459772

Issue Links

Activity

Hide
Steve Tekell added a comment -

it'd be nice if GORM DSL supported all the mapping options.

Show
Steve Tekell added a comment - it'd be nice if GORM DSL supported all the mapping options.
Hide
Peter Ledbrook added a comment -

Fixing GRAILS-3201 will probably result in GRAILS-3388 being fixed too.

Show
Peter Ledbrook added a comment - Fixing GRAILS-3201 will probably result in GRAILS-3388 being fixed too.
Hide
Peter Ledbrook added a comment -

The original issue has been implemented so you can use "sqlType" as a column attribute. The only time you would really want to do this is if "type" is a custom user type, otherwise you would normally use "type" to specify the SQL type of the column.

Show
Peter Ledbrook added a comment - The original issue has been implemented so you can use "sqlType" as a column attribute. The only time you would really want to do this is if "type" is a custom user type, otherwise you would normally use "type" to specify the SQL type of the column.
Hide
Graeme Rocher added a comment -

Bulk closing bunch of resolved issues

Show
Graeme Rocher added a comment - Bulk closing bunch of resolved issues

People

Vote (2)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: