Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In all these tests I am using some strategies to make sure that tables and fields name generated by Hibernate will be the same as Eclipse-Link.

...

Control Loop runtime uses persistence.xml file: is the deployment descriptor file for persistence using JPA. It specifies the persistence units and declares the managed persistence classes, the object/relation mapping, and the database connection details.

Hibernate

SpringBoot auto-configuration can automatically scan entity classes. In Control Loop Runtime we can use @EntityScan annotation because entity classes are not placed in the main application package or its sub-packages. In this situation, we need declare the package or list of packages in the main configuration class within @EntityScan annotation.

...


MariaDB [controlloop]> select * from ExampleObjMap;
+--------------------------+---------------+---------+
| EXAMPLES                 | name          | version |
+--------------------------+---------------+---------+
| .... <binary code> .... | ExampleObjMap | 1.0.0   |
+--------------------------+---------------+---------+

...

MariaDB [controlloop]> SHOW CREATE TABLE JpaExampleObjMapEc_EXAMPLES;
+-----------------------------+-------------------------------------------------------------------------------------------------------+
| Table                       | Create Table                                                                                                                                                                                                                                                                                                                                                                                                                                       |
+-----------------------------+-------------------------------------------------------------------------------------------------------+
| JpaExampleObjMapEc_EXAMPLES | CREATE TABLE `JpaExampleObjMapEc_EXAMPLES` (
`name` varchar(120) DEFAULT NULL,
  `version` varchar(20) DEFAULT NULL,
  `EXAMPLES` longblob DEFAULT NULL,
  `EXAMPLES_KEY` varchar(255) DEFAULT NULL,
  KEY `FK_JpaExampleObjMapEc_EXAMPLES_name` (`name`,`version`),
  CONSTRAINT `FK_JpaExampleObjMapEc_EXAMPLES_name` FOREIGN KEY (`name`, `version`)
REFERENCES `ExampleObjMapEc` (`name`, `version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 |
+-----------------------------+-------------------------------------------------------------------------------------------------------+


After saving the example:


MariaDB [controlloop]> select * from ExampleObjMapEc;
+---------------+---------+
| name          | version |
+---------------+---------+
| ExampleObjMap | 1.0.0   |
+---------------+---------+

MariaDB [controlloop]> select * from JpaExampleObjMapEc_EXAMPLES;
+---------------+---------+---------------------------+
| name          | version | EXAMPLES                                                                                                                                                                                                                                                                                                                                                                                                                                    | EXAMPLES_KEY |
+---------------+---------+---------------------------+
| ExampleObjMap | 1.0.0   |  .... <binary code> ....  |
| ExampleObjMap | 1.0.0   |  .... <binary code> .... |
+---------------+---------+---------------------------+

...