Skip to content

Instantly share code, notes, and snippets.

@fsans
Created November 15, 2018 11:19
Show Gist options
  • Save fsans/6902c696471502f8e52b853822730fc1 to your computer and use it in GitHub Desktop.
Save fsans/6902c696471502f8e52b853822730fc1 to your computer and use it in GitHub Desktop.

Integrating FileMaker with Spring JPA/Hibernate HowTo

The FileMakerDialect.class was cretaed by John Keates, Forked from: https://github.com/johnkeates/hibernate-filemaker-dialect

This is just an implementation note.

Add FileMaker JDBC dirver to the classpath: (provided by FileMaker Inc. http://www.filemaker.com

I do not know any Maven source.

fmjdbc.jar

Add the following dependencies to your Maven project:

<!-- hikari -->
<dependency>
    <groupId>com.zaxxer</groupId>
    <artifactId>HikariCP</artifactId>
</dependency>

<!-- needed for Hikari Configuration -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-configuration-processor</artifactId>
    <optional>true</optional>
</dependency>

setup the following properties in application.properties

# Hibernate did not recognize itsels which database is FileMaker
# so help it providing the driver to be used
spring.datasource.driver-class-name=com.filemaker.jdbc.Driver

# add "useSSL=false"
# no need to ask for UTF encoding, since FM always stores Unicode UTF8
spring.datasource.url=jdbc:filemaker://host/database?useSSL=false

# access credentials as usual
spring.datasource.username=**username**
spring.datasource.password=**password**

# add the custom Hibernate Dialect to the classpath
# and tell Spring to use it with FileMaker driver
spring.jpa.properties.hibernate.dialect = nl.keates.filemaker.hibernate.dialect.FileMakerDialect

# FM jdbc driver does not allow schema modifications, so disable updates
spring.jpa.hibernate.ddl-auto = none

# FM jdbc driver does not allow "SELECT 1" default connectivity test, so setup this
spring.datasource.hikari.connection-test-query=SELECT p.* FROM FileMaker_Tables p

# setup other properties as usual, like the following
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type=TRACE

NOTE: FileMaker SQL support is very poor, not supporting in any way reverse engeneering the database schema (maybe because FileMaker databases do not have 'schema') and constrains (can't see the defined relationships).

When generatinig entities from the database connection, do not forget to set all the @Id columns and create the required associations, because Hibernate can''t look inside.

@fsans
Copy link
Author

fsans commented May 19, 2023

Error: Couldn't determine Dialect for "filemaker"

This means that Hibernate couldn't determine by itself the dialect from the driver (as expected for this case). You should tell to spring which driver to use and to Hibernate which dialect to talk with...

spring.datasource.driver-class-name = com.filemaker.jdbc.Driver
spring.jpa.properties.hibernate.dialect = nl.keates.filemaker.hibernate.dialect.FileMakerDialect

(see all relevant configuration above in early coments)

Let me know what.

@Drew1314
Copy link

Is there an updated dialect for hibernate 6?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment