We have this school project where we are creating a book library system where the main purpose is to use a database connection. In this case JPA and ObjectDB.
Our problem is that we have 3 tables. One that describes a book (title, author and published year), the second a borrower (first name, last name, address, email and phonenumber) and the last table the lending-function that gets the primary ID-key from the other two tables.
The problem is that when we are using the list borrowed book-function it prints out only the IDs from the two other tables. We think the problem is the SQL-query and we haven't gotten the chance to learn SQL properly.
So our question is, how do we create a SQL query that gets the title from the book-table and the first and last name from the borrower table and not the IDs.
The SQL-query where we have only managed to work is this:
TypedQuery<BokLån> q = em.createQuery("SELECT bookborrow FROM BookBorrow BookBorrow", BookBorrow.class);