Eclipse Hibernate.cfg.xml链接到"sys"目录.来自MySQL的数据库 [英] Eclipse Hibernate.cfg.xml is linking "sys" database from MySQL

查看:57
本文介绍了Eclipse Hibernate.cfg.xml链接到"sys"目录.来自MySQL的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Hibernate连接到MySQL数据库 bookstoredb 时,在Eclipse中,也会显示与MySQL sys 数据库的连接!

When I use Hibernate to connect to a MySQL database, bookstoredb, in Eclipse, a connection to the MySQL sys database also shows up!

我正在使用以下内容:

  • Ubuntu 18.04.5 LTS(台式机)
  • 带JBoss工具,Hibernate-Tools插件的Eclipse 2020-6(4.16.0).
  • 用于x86_64上的Linux的MySQL Ver 8.0.21(MySQL社区服务器-GPL)

注意:这是一个本地桌面项目,我正在完成一个教程.我以后不会在MySQL上使用root/admin.

Note: this is a local desktop project, I am working through a tutorial. I will NOT be using root/admin with MySQL down the road.

以下是完整的hibernate.cfg.xml:

Following is the complete hibernate.cfg.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.password">admin</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/bookstoredb?serverTimezone=UTC</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    </session-factory>
</hibernate-configuration>

我误会了,不应该给定的connection.url仅连接到 bookstoredb 吗?为什么是"sys"?还连接吗?

Am I misunderstanding, shouldn't the connection.url, as given, ONLY connect to bookstoredb? Why is "sys" connecting also?

使用该工具将数据库表反向工程为Java类时,这甚至成为问题.我不仅得到 bookstoredb 表作为java类,而且还得到 sys 数据库中的每个表.而且我相信很多人都知道.

This becomes even more of a problem when using the tool to reverse-engineer the database tables into java classes. I'm getting not only the bookstoredb tables as java classes but every table in the sys database as well. And there are a lot of them, as I am sure folks well know.

如何取消链接 sys 数据库?还是进行设置,以便我不首先链接到它?

How do I unlink the sys database? Or set things up so I don't link to it in the first place?

推荐答案

我想sys是MySQL工作台中的默认架构.

I guess sys is the default schema in your MySQL workbench.

转到Mysql工作台并删除架构/因为它是从本地服务器导入所有架构.

Go to your Mysql workbench and drop the schema/because it is importing all the schemas from your local server.

自定义:-打开您的工作区(在屏幕顶部的eclipse(运行"标签->休眠代码生成)->转到休眠代码生成(->单击main-> revenge.xml->;选择新建->选择文件夹->配置表过滤器->(1)选择要选择的数据库->导入所有表->应用->运行.

Custom :- Open your workspace(eclipse("run" tab on top of screen->hibernate code genration) -> Go to hibernate code generation( -> click main-> revenge.xml->select new -> select folder-> configure table filter-> (1)select database you want to select-> import all table-> apply -> Run .

现在,您可以在所选位置查看所有表格.如果您要客户出口,也可以在上述(1)步骤之后进行

Now you can see all the tables in the location you have selected. If you want to customer export you could also do so after (1) step above

这篇关于Eclipse Hibernate.cfg.xml链接到"sys"目录.来自MySQL的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆