什么是JPA @Table注解“目录”和“模式”变量用于? [英] What are the JPA @Table annotation "catalog" and "schema" variables used for?

查看:297
本文介绍了什么是JPA @Table注解“目录”和“模式”变量用于?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么这些重要,他们对手头的数据库有什么影响?



不是已经决定的模式,因为它存在在数据库中?



到底什么是目录? JPA目录字段期望什么类型的变量/输入?目录和模式是您在服务器端定义的命名空间,它们是模式字段的相同问题。 的数据库。一些数据库包含模式,一些包含目录,一些包含两者。在使用特定用户登录时,某些数据库会将架构/目录默认为用户的名称空间,导致该表对其他用户不可见,从而导致需要使用公用名称空间。因此,根据您用来备份数据的数据库,您可能需要忽略这些设置。



对于MySQL,您可能需要忽略这些设置。这是因为JDBC URL(最后一个斜杠后面的那个)的数据库部分指向数据库名称,这在语义上与模式(用于MySQL)相同。


Why are these important, what effect do they have on the database at hand?

Isn't the "schema" already decided at that point, as it exists in the database?

What exactly is a "catalog"? What kind of variable/input is the JPA catalog field expecting? Also, same question for the "schema" field.

解决方案

Catalogs and schemas are "namespaces" that you define on the server side of the database. Some databases contains schemas, some contains catalogs, and some contains both. When logging in with a specific user, some databases defaults the schema/catalog to the user's namespace, causing the table to not be visible to other users, thus, causing the need to use a "common" namespace. So, depending on the database you are using to back your data, you might want to ignore those settings.

For MySQL, you might want to ignore those settings. This is because the "database" part of the JDBC URL (the one after the last slash) points to the database name, which is semantically identical to schema (for MySQL).

这篇关于什么是JPA @Table注解“目录”和“模式”变量用于?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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