简体   繁体   中英

eclipse - JPA entities from tables, no schemas listed

I have a database (called "socializer") residing within MariaDB server and I'm trying to generate JPA entities from tables of that database in Eclipse, but cannot, because schema selection is grayed . Any ideas why?

My setup: Eclipse Neon, Eclipse Link 2.5.2, MariaDB 10.1.19-1, Arch Linux.

I know that the connection to my database has been established, because I can see it listed in Data Source Explorer , but its "Schemas" folder is displayed just empty, although it actually contains a few tables, created and perfectly observed within MySQL Workbench (the other listed databases appear to have empty "Schemas" as well).

JDBC connection properties:

Database: "socializer"
URL: "jdbc:mariadb://localhost:3306/socializer"
User name: root
Password: ""

JDBC driver (Generic JDBC Driver, mariadb-java-client-1.5.5.jar) properties:

Connection URL: "jdbc:mariadb://localhost:3306/socializer"
Database Name: "socializer"
Driver Class: "org.mariadb.jdbc.Driver"
User ID: "root"

And yes, user name and password are ok (ping will fail if either of them is changed).

In Addition to the comments, I found another reason that might cause the problem, that no schema's are listed:

在此处输入图片说明

I run into this while trying to connect to another database with other schemas than before.

Go to Project -> Properties -> JPA and disable/uncheck Override default schema from connection

在此处输入图片说明

If there is a schema selected that doesn't exist in the selected database, no schemas will be shown when creating entities. For me the problem was, that Eclipse was trying to show a schema from the database before.

就我而言,我的数据库名称不区分大小写。

This Worked For me.... Go to Go to Project -> Properties -> JPA

check both checkboxes

  1. override default catlog from connection --> select ur connection
  2. check default schema for connnection --> select ur schema

and done.. :)

https://www.eclipse.org/datatools/downloads.php

install this plugin, i use 1.14.1 (Oxygen) version then create new jpa tools, choice mysql

In my case, I'm connecting to MySQL, and the problem is I need to add JDBC driver to Eclipse.

https://www.javahelps.com/2015/08/add-mysql-jdbc-driver-to-eclipse.html

Then when Eclipse asks you to select a connection profile, select the driver you added (MySQL for me, instead of Generic JDBC), and you should be able to see all schemas.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM