Skip to content

Commit

Permalink
refactor: remove deprecated hibernate structures/functions
Browse files Browse the repository at this point in the history
identifiers.hbm.xml -> identifiers.orm.xml

Refs: XRDDEV-2713
  • Loading branch information
ovidijusnortal committed Nov 18, 2024
1 parent dbe5429 commit ff09e08
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ spring:
throw-exception-if-no-handler-found: true
jpa:
## *.hbm.xml files are loaded from classpath
mapping-resources: identifiers.hbm.xml,serverconf.hbm.xml,apikey.orm.xml
mapping-resources: identifiers.orm.xml,serverconf.hbm.xml,apikey.orm.xml
open-in-view: false
hibernate:
ddl-auto: none
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ spring:
hibernate:
ddl-auto: create
generate-ddl: true
show-sql: false
show-sql: true
defer-datasource-initialization: true
profiles:
active: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ VALUES (12, 'C', 'SUBSYSTEM', 'DUMMY', 'PRO', 'M2', 'SS6');
INSERT INTO IDENTIFIER(ID, DISCRIMINATOR, TYPE, X_ROAD_INSTANCE, MEMBER_CLASS, MEMBER_CODE, SUBSYSTEM_CODE)
VALUES (13, 'C', 'SUBSYSTEM', 'FI', 'DUMMY', 'M2', 'SS6');

ALTER SEQUENCE identifier_seq RESTART WITH 63;


-- local clients, comment contains identifier_id, client identifier
-- 1, FI:GOV:M1
Expand Down Expand Up @@ -175,6 +177,8 @@ VALUES (16, 11, {ts '2020-01-02 12:08:30.000000'}, 2, 13);
INSERT INTO APIKEY (ID, ENCODEDKEY)
VALUES (1, 'ad26a8235b3e847dc0b9ac34733d5acb39e2b6af634796e7eebe171165cdf2d1');

ALTER SEQUENCE apikey_seq RESTART WITH 51;

INSERT INTO APIKEY_ROLES (APIKEY_ID, ROLE)
VALUES (1, 'XROAD_SYSTEM_ADMINISTRATOR');
INSERT INTO APIKEY_ROLES (APIKEY_ID, ROLE)
Expand Down
53 changes: 0 additions & 53 deletions src/serverconf/src/main/resources/identifiers.hbm.xml

This file was deleted.

63 changes: 63 additions & 0 deletions src/serverconf/src/main/resources/identifiers.orm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://xmlns.jcp.org/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_2_2.xsd"
version="2.2">
<package>ee.ria.xroad.common.identifier</package>
<mapped-superclass class="AbstractGroupId$Conf" access="FIELD">
<attributes>
<basic name="groupCode" access="FIELD"/>
</attributes>
</mapped-superclass>
<entity class="XRoadId$Conf" access="FIELD">

<table name="IDENTIFIER"/>
<inheritance strategy="SINGLE_TABLE"/>
<discriminator-column name="DISCRIMINATOR" discriminator-type="STRING"/>
<attributes>
<id name="id" access="FIELD">
<column name="id"/>
<generated-value strategy="AUTO"/>
</id>
<basic name="type" access="FIELD">
<enumerated>STRING</enumerated>
</basic>
<basic name="xRoadInstance" access="FIELD" />
</attributes>
</entity>
<entity class="ClientId$Conf" name="ClientConf">
<discriminator-value>C</discriminator-value>

<attributes>
<basic name="memberClass" access="FIELD"/>
<basic name="memberCode" access="FIELD"/>
<basic name="subsystemCode" access="FIELD"/>
</attributes>
</entity>
<entity class="ServiceId$Conf" name="ServiceIdConf">
<discriminator-value>S</discriminator-value>
<attributes>
<basic name="memberClass" access="FIELD"/>
<basic name="memberCode" access="FIELD"/>
<basic name="serviceVersion" access="FIELD"/>
<basic name="subsystemCode" access="FIELD"/>
<basic name="serviceCode" access="FIELD"/>
</attributes>
</entity>
<entity class="GlobalGroupId$Conf" name="GlobalGroupConf">
<discriminator-value>GG</discriminator-value>
</entity>
<entity class="LocalGroupId$Conf" name="LocalGroupConf">
<discriminator-value>LG</discriminator-value>
</entity>
<entity class="SecurityServerId$Conf" name="SecurityServerIdConf">
<discriminator-value>SS</discriminator-value>
<attributes>
<basic name="memberClass" access="FIELD"/>
<basic name="memberCode" access="FIELD"/>
<basic name="serverCode" access="FIELD"/>
</attributes>
</entity>

</entity-mappings>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
<property name="hibernate.id.db_structure_naming_strategy">legacy</property>
<!--TODO Migrate hbm.xml to orm.xml or mapping xml -->
<mapping resource="serverconf.hbm.xml"/>
<mapping resource="identifiers.hbm.xml"/>
<mapping resource="identifiers.orm.xml"/>
</session-factory>
</hibernate-configuration>

0 comments on commit ff09e08

Please sign in to comment.