I'm trying to get my table ids to use pre written sequences when the table schemas are generated by hibernate but they only ever get defined as bigints using the default hibernate_sequence
Code:
<class name="edina.clive.domain.Layer" table="layers" dynamic-insert="true" dynamic-update="true">
<meta attribute="class-description">
A layer object which holds a list of layer sub-objects and a list of Style names in place of a style object
</meta>
<id name="layerID" type="long" unsaved-value="null">
<generator class="sequence">
<param name="sequence">layer_layerid_seq</param>
</generator>
</id>
<property name="layerName" lazy="false" unique="true" type="string" length="64"/>
<property name="layerTitle" lazy="false" not-null="true" type="string" length="128"/>
<property name="srs" column="layerSRS" type="string" length="32" lazy="false" /> <!-- auto generated from geometry? -->
<property name="minimumScale" column="layerscalemin" lazy="false" />
<property name="maximumScale" column="layerscalemax" lazy="false" />
<!-- Cannot test on HSQLDB as it is not spatial, this will enter bounding box as text for testing -->
<!-- <property name="boundingBox" type="edina.clive.domain.hibernate.EnvelopeUserType" />-->
<property name="boundingBoxGeometry" type="org.hibernatespatial.GeometryUserType" />
<property name="subLayers" type="edina.clive.domain.hibernate.SubLayerUserType" lazy="false"/>
<!-- it may be possible to do this the originally intended way (having two comma separated fields in the Layer table and building from them) -->
<set name="styles" table="STYLES" cascade="save-update" lazy="false">
<key column="layerID" />
<one-to-many class="edina.clive.domain.Style" />
</set>
</class>
Code:
CREATE TABLE layers
(
layerid bigint NOT NULL,
...
)
I want...
Code:
CREATE TABLE layers
(
layerid bigint NOT NULL DEFAULT NEXTVAL('layers_layerid_seq'),
...
)
Why isn't Hibernate picking up the sequences when I'm hard coding them in?