diff --git a/sticker-business/pom.xml b/sticker-business/pom.xml
index 9b1cc3a..99eeaaf 100644
--- a/sticker-business/pom.xml
+++ b/sticker-business/pom.xml
@@ -43,6 +43,18 @@
spring-boot-starter-data-jpa
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ com.h2database
+ h2
+ test
+
+
com.mysql
mysql-connector-j
diff --git a/sticker-business/src/main/java/gold_star/sticker_business/StickerBusinessApplication.java b/sticker-business/src/main/java/gold_star/sticker_business/StickerBusinessApplication.java
index b8c99f1..2cb59b6 100644
--- a/sticker-business/src/main/java/gold_star/sticker_business/StickerBusinessApplication.java
+++ b/sticker-business/src/main/java/gold_star/sticker_business/StickerBusinessApplication.java
@@ -1,5 +1,10 @@
package gold_star.sticker_business;
+import gold_star.sticker_business.entities.Sticker;
+import org.hibernate.SessionFactory;
+import org.hibernate.boot.MetadataSources;
+import org.hibernate.boot.registry.StandardServiceRegistry;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -36,5 +41,20 @@ public String home() {
public static void main(String[] args) {
SpringApplication.run(StickerBusinessApplication.class, args);
+
+ // A SessionFactory is set up once for an application!
+ final StandardServiceRegistry registry = new StandardServiceRegistryBuilder().build();
+ SessionFactory sessionFactory;
+ try {
+ sessionFactory =
+ new MetadataSources(registry)
+ .addAnnotatedClass(Sticker.class)
+ .buildMetadata()
+ .buildSessionFactory();
+ } catch (Exception e) {
+ // The registry would be destroyed by the SessionFactory, but we
+ // had trouble building the SessionFactory so destroy it manually.
+ StandardServiceRegistryBuilder.destroy(registry);
+ }
}
}
diff --git a/sticker-business/src/main/java/gold_star/sticker_business/entities/AddressConverter.java b/sticker-business/src/main/java/gold_star/sticker_business/entities/AddressConverter.java
new file mode 100644
index 0000000..6f9c53f
--- /dev/null
+++ b/sticker-business/src/main/java/gold_star/sticker_business/entities/AddressConverter.java
@@ -0,0 +1,20 @@
+package gold_star.sticker_business.entities;
+
+import jakarta.persistence.AttributeConverter;
+import java.util.Map;
+import tools.jackson.core.type.TypeReference;
+import tools.jackson.databind.ObjectMapper;
+
+public class AddressConverter implements AttributeConverter