Skip to content

A simple library management system handling books, authors, categories, publishers, and borrowing operations. Built with Java 21, JPA (Hibernate), Maven, and PostgreSQL 16+ for persistence and relational mapping.

Notifications You must be signed in to change notification settings

bekirahmetli/JPA_Library_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library Management System (JPA/Hibernate + PostgreSQL)

This project is a simple library management system handling books, authors, categories, publishers, and borrowing operations. It uses JPA (Hibernate) and runs on PostgreSQL.

Contents

  • Purpose and scope
  • Project requirements
  • Setup and run
  • Database schema and tables
  • Sample data
  • Screenshots

Purpose and Scope

  • Entities: book, author, category, publisher, book_borrowing and their relations.
  • Relations:
    • Author (One) ↔ Book (Many)
    • Publisher (One) ↔ Book (Many)
    • Category (Many) ↔ Book (Many) — join table: category_book
    • Book (One) ↔ BookBorrowing (Many)

Requirements

  • Java 21
  • Maven
  • PostgreSQL 14+

Setup and Run

  1. Create the PostgreSQL database:
CREATE DATABASE library_management_system;
  1. Update connection properties in src/main/resources/META-INF/persistence.xml:
  • URL: jdbc:postgresql://localhost:5432/library_management_system
  • Username: postgres
  • Password: your password
  1. Maven dependencies
  • Dependencies already exist in pom.xml
  1. Entity package mapping
  • In Hibernate 6.5 and later, entity classes must be explicitly declared in the persistence.xml file.
  1. Schema generation strategy
  • For development: hibernate.hbm2ddl.auto = create
  • Alternatively: update

Database Schema and Tables

Expected tables:

  • author
  • publisher
  • book
  • category
  • book_borrowing
  • category_book (join table)

Relation notes:

  • book.author_idauthor.author_id (ManyToOne)
  • book.publisher_idpublisher.publisher_id (ManyToOne)
  • category_book connects book and category (ManyToMany)
  • book_borrowing.book_idbook.book_id (ManyToOne)

Sample Data

When LibraryManagementSystemMain runs, it inserts sample data. book_borrowing.returnDate is null initially; set it on return.

Screenshots

  • author
  • author
  • publisher
  • publisher
  • book
  • book
  • category
  • category
  • book_borrowing
  • book_borrowing
  • category_book
  • category_book

Kütüphane Yönetim Sistemi (JPA/Hibernate + PostgreSQL)

Bu proje, kitap, yazar, kategori, yayınevi ve ödünç alma süreçlerini yöneten basit bir kütüphane yönetim sistemidir. JPA (Hibernate) ile PostgreSQL üzerinde çalışır.

İçerik

  • Amaç ve kapsam
  • Proje gereksinimleri
  • Kurulum ve çalıştırma
  • Veritabanı şema ve tablolar
  • Test için örnek veriler
  • Ekran görüntüleri

Amaç ve Kapsam

  • Kitap (book), Yazar (author), Kategori (category), Yayınevi (publisher), Ödünç Alma (book_borrowing) tablolarını ve ilişkilerini içerir.
  • İlişkiler:
    • Yazar (One) ↔ Kitap (Many)
    • Yayınevi (One) ↔ Kitap (Many)
    • Kategori (Many) ↔ Kitap (Many) — join tablo: category_book
    • Kitap (One) ↔ Ödünç Alma (Many)

Proje Gereksinimleri

  • Java 21
  • Maven
  • PostgreSQL 14+

Kurulum ve Çalıştırma

  1. PostgreSQL veritabanını oluşturun:
CREATE DATABASE library_management_system;
  1. src/main/resources/META-INF/persistence.xml içinde bağlantı bilgilerini kendi ortamınıza göre güncelleyin:
  • URL: jdbc:postgresql://localhost:5432/library_management_system
  • Kullanıcı adı: postgres
  • Şifre: şifreniz
  1. Maven bağımlılıkları
  • pom.xml içerisinde bağımlılıklar zaten mevcut.
  1. Entity sınıfları paketi
  • Hibernate 6.5 ve sonrasında,persistence.xml dosyasında entity sınıflarının açıkça belirtilmesi gerekmektedir.
  1. Şema oluşturma stratejisi
  • Geliştirme için: hibernate.hbm2ddl.auto = create
  • Alternatif: update

Veritabanı Şema ve Tablolar

Oluşması beklenen tablolar:

  • author
  • publisher
  • book
  • category
  • book_borrowing
  • category_book (ManyToMany join tablosu)

İlişki notları:

  • book.author_idauthor.author_id (ManyToOne)
  • book.publisher_idpublisher.publisher_id (ManyToOne)
  • category_book join tablosu ile book ve category arasında ManyToMany
  • book_borrowing.book_idbook.book_id (ManyToOne)

Test İçin Örnek Veriler

LibraryManagementSystemMain çalıştığında örnek veri eklenir. book_borrowing.returnDate alanı ilk eklemede null bırakılır; iade edildiğinde tarih güncelleyebilirsiniz.

Ekran Görüntüleri

  • author
  • author
  • publisher
  • publisher
  • book
  • book
  • category
  • category
  • book_borrowing
  • book_borrowing
  • category_book
  • category_book

About

A simple library management system handling books, authors, categories, publishers, and borrowing operations. Built with Java 21, JPA (Hibernate), Maven, and PostgreSQL 16+ for persistence and relational mapping.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages