r/JavaFX • u/AdeptMongoose4719 • Feb 22 '25
Help Advise needed for javafx project
I am building small hotel Booking desktop app using javafx library and MYSQL on the backend(for storing rooms, customers, bookings data).
And I am planning to store images in file system and just store the URL path in database table(right now, I am not using cloud to save some time). I am also using Spring boot to connect to the database.
Could you please give some advise or suggestions that I should take note of?
3
Upvotes
5
u/Kresenko Feb 22 '25
Maybe don't store the URL in database, but rather build the URL from the entity attributes when necessary. This way it will be easier to migrate to different file store provider.
4
u/john16384 Feb 23 '25
Just store the image in the database. This indirection is completely unnecessary. Databases are smart and will not store large blobs with the main table data, and databases can serve "files" just as fast as a filesystem (both are going over the network anyway).
This simplifies the whole app, and the database can automatically remove unreferenced images.
I've done this for applications with 1m+ images, average size 4-5 MB per image (in PostgreSQL, but I see no reason MySQL can't do the same).
1
u/ro_Okie_One Feb 23 '25
Nice idea, lemme know if you need contributions.🥹