Skip to content

Commit

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

Refs: XRDDEV-2713
  • Loading branch information
ovidijusnortal committed Nov 18, 2024
1 parent 8a9529d commit dbe5429
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
spring:
jpa:
mapping-resources:
- apikey.hbm.xml
- apikey.orm.xml
open-in-view: false
hibernate:
ddl-auto: validate
Expand Down
24 changes: 0 additions & 24 deletions src/common/common-admin-api/src/main/resources/apikey.hbm.xml

This file was deleted.

37 changes: 37 additions & 0 deletions src/common/common-admin-api/src/main/resources/apikey.orm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?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>org.niis.xroad.restapi.domain</package>

<!-- Entity Definition -->
<entity class="PersistentApiKeyType" access="FIELD">
<table name="APIKEY"/>

<!-- ID mapping -->
<attributes>
<id name="id" access="FIELD">
<column name="id"/>
<generated-value strategy="AUTO"/>
</id>

<!-- Basic properties -->
<basic name="encodedKey">
<column name="encodedkey"/>
</basic>

<!-- Enum Set Mapping -->
<element-collection name="roles" access="FIELD" fetch="EAGER">
<column name="role" nullable="false"/>
<enumerated>STRING</enumerated>
<collection-table name="APIKEY_ROLES">
<join-column name="apikey_id"/>
</collection-table>
</element-collection>
</attributes>

</entity>

</entity-mappings>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# properties for test runtime
spring:
jpa:
mapping-resources: apikey.hbm.xml
mapping-resources: apikey.orm.xml
open-in-view: false
generate-ddl: true
show-sql: false
Expand Down
2 changes: 2 additions & 0 deletions src/common/common-admin-api/src/test/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ INSERT INTO APIKEY_ROLES (APIKEY_ID, ROLE)
VALUES (1, 'XROAD_SERVICE_ADMINISTRATOR');
INSERT INTO APIKEY_ROLES (APIKEY_ID, ROLE)
VALUES (1, 'XROAD_REGISTRATION_OFFICER');

ALTER SEQUENCE apikey_seq RESTART WITH 51;
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.hbm.xml
mapping-resources: identifiers.hbm.xml,serverconf.hbm.xml,apikey.orm.xml
open-in-view: false
hibernate:
ddl-auto: none
Expand Down

0 comments on commit dbe5429

Please sign in to comment.