user@debian:~/NetBeansProjects/MiniProject$ ls -a
.  ..  .git  main_csv_files  mydatabase.sqlite  nbproject  pom.xml  src  target  test_csv_files
user@debian:~/NetBeansProjects/MiniProject$ cd src/
user@debian:~/NetBeansProjects/MiniProject/src$ find . -name "*"
.
./main
./main/java
./main/java/com
./main/java/com/mycompany
./main/java/com/mycompany/myapp
./main/java/com/mycompany/myapp/Basket.java
./main/java/com/mycompany/myapp/Driver.java
./main/java/com/mycompany/myapp/HibernateUtil.java
./main/java/com/mycompany/myapp/Kiwi.java
./main/java/com/mycompany/myapp/KiwiConverter.java
./main/java/com/mycompany/myapp/Watermelon.java
./main/java/com/mycompany/myapp/WatermelonConverter.java
./main/java/com/mycompany/myapp/BasketDao.java
./main/java/com/mycompany/myapp/StringListConverter.java
./main/resources
./main/resources/hibernate.cfg.xml
./test
./test/java
./test/java/com
./test/java/com/mycompany
./test/java/com/mycompany/tradingpairinvestmentapp
user@debian:~/NetBeansProjects/MiniProject/src$

Basket.java:

package com.mycompany.myapp;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Convert;
import jakarta.persistence.ElementCollection;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OneToOne;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

@Entity
public class Basket implements Serializable {
        
    @Id
    @GeneratedValue(strategy = GenerationType.UUID)
    @Column(name="basketUuid")
    private String basketUuid;
    
    private String brandName;
    
    @Convert(converter = WatermelonConverter.class)
    @OneToOne(mappedBy="basket", cascade=CascadeType.ALL)
    private Watermelon watermelon;

    @Convert(converter = KiwiConverter.class)
    @Convert(converter = StringListConverter.class)
    @OneToMany(mappedBy="basket", cascade=CascadeType.ALL)
    @ElementCollection
    private List<Kiwi> kiwis;
    
    public Basket() {
        this(UUID.randomUUID().toString(), "Generic", new Watermelon(), new ArrayList<Kiwi>());
    }

    public Basket(String basketUuid, String brandName, Watermelon watermelon, List<Kiwi> kiwis) {
        this.basketUuid = basketUuid;
        this.brandName = brandName;
        this.watermelon = watermelon;
        this.kiwis = kiwis;
    }

    public String getBasketUuid() {
        return basketUuid;
    }

    public void setBasketUuid(String basketUuid) {
        this.basketUuid = basketUuid;
    }

    public String getBrandName() {
        return brandName;
    }

    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }

    public Watermelon getWatermelon() {
        return watermelon;
    }

    public void setWatermelon(Watermelon watermelon) {
        this.watermelon = watermelon;
    }

    public List<Kiwi> getKiwis() {
        return kiwis;
    }

    public void setKiwis(List<Kiwi> kiwis) {
        this.kiwis = kiwis;
    }
}


BasketDao.java:

package com.mycompany.myapp;

import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.Transaction;

public class BasketDao {
    private static BasketDao transactionSetDao = null;
    
    private BasketDao() {}
    
    public static BasketDao getInstance() {
        if(transactionSetDao == null) {
            transactionSetDao = new BasketDao();
        }
        
        return transactionSetDao;
    }
    
    public<T> void save(T data) {
        Transaction tx = null;
        
        try( Session session = HibernateUtil.getSessionFactory().openSession() ) {
            tx = session.beginTransaction();
            
            session.merge(data);
            
            tx.commit();
        }
    }
    
    public <T> List<T> loadAllData(Class<T> type) {
        Transaction tx = null;
        
        try( Session session = HibernateUtil.getSessionFactory().openSession() ) {
            tx = session.beginTransaction();
            
            CriteriaBuilder builder = session.getCriteriaBuilder();
            CriteriaQuery<T> criteria = builder.createQuery(type);
            criteria.from(type);

            List<T> data = session.createQuery(criteria).getResultList();

            tx.commit();
            
            return data;
        }
    }
}


package com.mycompany.myapp;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

public class Driver {

    public static void main(String[] args) throws Exception {
//        TradingPairsFacade tradingPairsFacade = new TradingPairsFacade( new MinOfThreeStrategy() );
//        List<TradingPair> tradingPairsList = tradingPairsFacade.getFiveConsecutiveMonotonicIncreasesBuySellList();
////        List<TradingPair> tradingPairsList = tradingPairsFacade.getNormalListYo();
//        
//        System.out.println("==================================================================================");
//        for(int i = 0; i < tradingPairsList.size(); i++) {
//            System.out.println("#"+(i+1)+")");
//            System.out.println( tradingPairsList.get(i) );
//            System.out.println("==================================================================================");
//        }

//        TransactionsFacade transactionsFacade = new TransactionsFacade();
//        List<ITransactionSet> transactions = new LinkedList<>();
////        transactions.add( new Watermelonn(1.0, 1.25, LocalDateTime.now(), false) );
////        transactions.add( new Tra );
//        transactions.add( new Watermelon(20.0, LocalDateTime.now().plusMinutes(5)) );
//        transactionsFacade.saveTransactions(transactions);

//        Transaction tx = null;
        
        try/*( Session session = HibernateUtil.getSessionFactory().openSession() )*/ {
//            tx = session.beginTransaction();

            Watermelon watermelon = new Watermelon(10.0, LocalDateTime.now());
            Kiwi kiwi1 = new Kiwi();
            kiwi1.setPurchasePrice(1.0);
            kiwi1.setPurchaseTimestamp(LocalDateTime.now());
            Kiwi kiwi2 = new Kiwi();
            kiwi2.setPurchasePrice(1.0);
            kiwi2.setPurchaseTimestamp(LocalDateTime.now().plusMinutes(1));
            List<Kiwi> kiwis = new ArrayList<>(2);
            kiwis.add(kiwi1);
            kiwis.add(kiwi2);
            
            Basket basket = new Basket();
            basket.setBrandName("Tote");
            basket.setWatermelon(watermelon);
            basket.setKiwis(kiwis);
            BasketDao.getInstance().save(basket);

//            tx.commit();
        } catch (Exception e) {
//            tx.rollback();
            e.printStackTrace();
        }
    }
}

HibernateUtil.java:
package com.mycompany.myapp;

import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.SessionFactoryBuilder;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources;

public class HibernateUtil {
    private static SessionFactory sessionFactory;

    private static SessionFactory buildSessionFactory() {
        StandardServiceRegistry standardRegistry = new StandardServiceRegistryBuilder().
                configure("hibernate.cfg.xml").build();

        Metadata metadata = new MetadataSources(standardRegistry).getMetadataBuilder().
                build();

        SessionFactoryBuilder sessionFactoryBuilder = metadata.getSessionFactoryBuilder();

        SessionFactory sessionFactory = sessionFactoryBuilder.build();

        return sessionFactory;
    }

    public static SessionFactory getSessionFactory() {
        if (sessionFactory == null) {
            sessionFactory = buildSessionFactory();
        }
        return sessionFactory;
    }
}

Kiwi.java:

package com.mycompany.myapp;

import jakarta.persistence.Entity;
import static jakarta.persistence.FetchType.LAZY;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import java.time.LocalDateTime;
import java.util.UUID;

@Entity
public class Kiwi {
    
    @Id
    @GeneratedValue(strategy = GenerationType.UUID)
    private String kiwiUuid;
    
    private double purchasePrice;
    
    private LocalDateTime purchaseTimestamp;
    
    @ManyToOne(fetch=LAZY)
    @JoinColumn(name="basketUuid")
    private Basket basket;

    public Kiwi() {
        this(UUID.randomUUID().toString(), 1.0, LocalDateTime.now(), new Basket());
    }

    public Kiwi(String kiwiUuid, double purchasePrice, LocalDateTime purchaseTimestamp, Basket basket) {
        this.kiwiUuid = kiwiUuid;
        this.purchasePrice = purchasePrice;
        this.purchaseTimestamp = purchaseTimestamp;
        this.basket = basket;
    }

    public String getKiwiUuid() {
        return kiwiUuid;
    }

    public void setKiwiUuid(String kiwiUuid) {
        this.kiwiUuid = kiwiUuid;
    }

    public double getPurchasePrice() {
        return purchasePrice;
    }

    public void setPurchasePrice(double purchasePrice) {
        this.purchasePrice = purchasePrice;
    }

    public LocalDateTime getPurchaseTimestamp() {
        return purchaseTimestamp;
    }

    public void setPurchaseTimestamp(LocalDateTime purchaseTimestamp) {
        this.purchaseTimestamp = purchaseTimestamp;
    }

    public Basket getBasket() {
        return basket;
    }

    public void setBasket(Basket basket) {
        this.basket = basket;
    }
}


KiwiConverter.java:

package com.mycompany.myapp;

import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;
import java.time.LocalDateTime;

@Converter
public class KiwiConverter implements AttributeConverter<Kiwi,String> {
    
    private static final String SEPARATOR = ";";

    @Override
    public String convertToDatabaseColumn(Kiwi kiwi) {
        StringBuilder sb = new StringBuilder();
        
        sb.append( kiwi.getKiwiUuid() );
        sb.append( SEPARATOR );
        sb.append( kiwi.getPurchasePrice());
        sb.append( SEPARATOR );
        sb.append( kiwi.getPurchaseTimestamp());
        
        return sb.toString();
    }

    @Override
    public Kiwi convertToEntityAttribute(String dbKiwi) {
        String[] parts = dbKiwi.split(SEPARATOR);
        
        Kiwi kiwi = new Kiwi();
        
        int i = 0;
        kiwi.setKiwiUuid( parts[i++] );
        kiwi.setPurchasePrice( Double.parseDouble(parts[i++]) );
        kiwi.setPurchaseTimestamp( LocalDateTime.parse(parts[i++]) );
        /*Basket basket = new Basket(basketUuid, brandName, watermelon, kiwis);
        kiwi.setBasket(basket);*/
        
        return kiwi;
    }
    
}

StringListConverter.java:

package com.mycompany.myapp;

import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;
import java.util.Arrays;
import static java.util.Collections.emptyList;
import java.util.List;

@Converter
public class StringListConverter implements AttributeConverter<List<String>, String> {
    private static final String DELIMITER = ";";

    @Override
    public String convertToDatabaseColumn(List<String> stringList) {
        return stringList != null ? String.join(DELIMITER, stringList) : "";
    }

    @Override
    public List<String> convertToEntityAttribute(String string) {
        return string != null ? Arrays.asList(string.split(DELIMITER)) : emptyList();
    }
}

Watermelon.java:
package com.mycompany.myapp;

import jakarta.persistence.Basic;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToOne;
import java.time.LocalDateTime;

@Entity
public class Watermelon {
    @Id
    @GeneratedValue(strategy = GenerationType.UUID)
    private String watermelonUuid;
    
    private double purchasePrice;
    
    @Basic
    private LocalDateTime purchaseTimestamp;
    
    @OneToOne
    @JoinColumn(name="basketUuid")
    private Basket basket;
    
    public Watermelon() {
        this(0.0, LocalDateTime.now());
    }
    
    public Watermelon(double purchasePrice, LocalDateTime purchaseTimestamp) {
        this.purchasePrice = purchasePrice;
        this.purchaseTimestamp = purchaseTimestamp;
    }

    public String getWatermelonUuid() {
        return watermelonUuid;
    }

    public void setWatermelonUuid(String uuid) {
        this.watermelonUuid = uuid;
    }

    public double getPurchasePrice() {
        return purchasePrice;
    }

    public void setPurchasePrice(double purchasePrice) {
        this.purchasePrice = purchasePrice;
    }

    public LocalDateTime getPurchaseTimestamp() {
        return purchaseTimestamp;
    }

    public void setPurchaseTimestamp(LocalDateTime purchaseTimestamp) {
        this.purchaseTimestamp = purchaseTimestamp;
    }
}

WatermelonConverter.java:

package com.mycompany.myapp;

import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;
import java.time.LocalDateTime;

@Converter
public class WatermelonConverter implements AttributeConverter<Watermelon,String> {
    
    private static final String SEPARATOR = ";";

    @Override
    public String convertToDatabaseColumn(Watermelon watermelon) {
        StringBuilder sb = new StringBuilder();
        
        sb.append( watermelon.getWatermelonUuid() );
        sb.append( SEPARATOR );
        sb.append( watermelon.getPurchasePrice());
        sb.append( SEPARATOR );
        sb.append( watermelon.getPurchaseTimestamp());
        
        return sb.toString();
    }

    @Override
    public Watermelon convertToEntityAttribute(String dbWatermelon) {
        String[] parts = dbWatermelon.split(SEPARATOR);
        
        Watermelon watermelon = new Watermelon();
        
        int i = 0;
        watermelon.setWatermelonUuid( parts[i++] );
        watermelon.setPurchasePrice(Double.parseDouble(parts[i++]) );
        watermelon.setPurchaseTimestamp(LocalDateTime.parse(parts[i++]));
        
        return watermelon;
    }
}

hibernate.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <!-- Database connection settings -->
        <property name="connection.driver_class">org.sqlite.JDBC</property>
        <property name="connection.url">jdbc:sqlite:mydatabase.sqlite</property>
        
        <!-- SQL dialect for SQLite -->
        <!-- <property name="dialect">org.hibernate.dialect.SQLiteDialect</property> -->
        <property name="hibernate.dialect">org.hibernate.community.dialect.SQLiteDialect</property> <!-- <property name="hibernate.dialect">org.hibernate.dialect.SQLiteDialect</property> -->
        <property name="hbm2ddl.auto">update</property> <!-- I think this means "create (the table) if not exists". -->
        <property name="show_sql">true</property> <!-- which query is doing or writing or wtv is being shown on console or something like that -->
        <mapping class="com.mycompany.myapp.Basket"/>
        <mapping class="com.mycompany.myapp.Watermelon"/>
        <mapping class="com.mycompany.myapp.Kiwi"/>
    </session-factory>
</hibernate-configuration>

What bugs could there be from the above syntax? How would I fix those? Be concise.