dictionary-jpa generates 2 types of jars with different usage
-uber
after the version number: used to generate dictionary database schemaPre-requisite: Generation of the database schema needs a database. The database should be configured either on base of https://github.com/rxue/dictionary-jpa/blob/main/src/main/resources/META-INF/persistence.xml or user should overwrite the properties in the peristence.xml
through command line below
java -Djakarta.persistence.schema-generation.database.action=create -jar dictionary-jpa-1.4-uber.jar
with a database configured on base of the default properties in persistence.xml embedded inside the uber-JAR. NOTE that the value of jakarta.persistence.schema-generation.action
has to be set to create
since the default value none
would not generate database schemaExample command of running the dictionary-jpa-1.4-uber.jar
with properties overwriting the properties in the default persistence.xml embedded inside the uber-JAR:
java -Djakarta.persistence.schema-generation.database.action=create -Djakarta.persistence.jdbc.password=1234 -jar dictionary-jpa-1.4-uber.jar
: password of the root
user of the target database is 1234
add the following block to pom.xml
<dependency>
<groupId>io.github.rxue</groupId>
<artifactId>dictionary-jpa</artifactId>
<version>1.6</version>
</dependency>
LexicalItemRepository
and ExplanationRepository
Think first from the frontend point of view:
CREATE
READ
UPDATE
DELETE
Unidirectional @ManyToOne
Association (Explanation
> LexicalItem
)
CREATE
ExplanationRepository
)READ
ExplanationRepository
)ExplanationRepository
is not trivial~UPDATE
LexicalItem
and Explanation
~DELETE
LexicalItemRepository.find
/EntityManager.find
to search for the managed entity and thEN call EntityManager.remove
~~This design strategy cannot simply meet the repositories.~
After trying the bidirectional @ManyToOne
association from Explanation
back to DictionaryEntry
, and then gradually tweaking back to unidirectional, unidirectional @ManyToOne
association is eventually decided to be used