Java hibernate JPA表名上的奇怪前缀

Java hibernate JPA表名上的奇怪前缀,java,spring,hibernate,jpa,mariadb,Java,Spring,Hibernate,Jpa,Mariadb,嗨,我正在使用hibernate和spring、liquibase、mariadb和JPA。我刚刚遇到一个奇怪的错误,我想这可能是hibernate中的一个bug,但我不能完全确定 我有两个实体: @Entity @Table(name = "portal") public class Portal { ... @OneToMany(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY) private Set<A

嗨,我正在使用hibernate和spring、liquibase、mariadb和JPA。我刚刚遇到一个奇怪的错误,我想这可能是hibernate中的一个bug,但我不能完全确定

我有两个实体:

@Entity
@Table(name = "portal")
public class Portal 
{
    ...
    @OneToMany(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
    private Set<AuthorisationCode> authorisationCodes = new HashSet<>();
    ...
 }
当然还有一个简单的存储库

@Repository
public interface PortalDao extends JpaRepository<Portal, Long>{}
=>


为什么hibernate要在查询中添加前缀“portal_u”?我甚至不知道为什么hibernate在调用save方法时还要执行select。有什么想法吗?

尝试将
mappedBy=“client”
添加到授权代码集中。在我看来,Hibernate正在尝试访问联接表门户授权代码,因为您没有告诉它以另一种方式访问。当然,只是猜测,但这似乎是一个合理的默认值。授权代码没有
@列
specified@Florian这解决了这个问题,但也带来了一个新的问题。。。org.mariadb.jdbc.internal.util.dao.QueryException:“字段列表”中的未知列“authorizat1.clientid”是否确定数据库中有一个名为clientid的列?更新后是否重新创建了数据库?因为在发生错误之前,Hibernate正在寻找一个不存在的表,我猜您不是在自动重新创建模式。您是否在
persistence.xml
中定义了
hibernate.hbm2ddl.auto
@Repository
public interface PortalDao extends JpaRepository<Portal, Long>{}
portalDao.save(portal);
org.mariadb.jdbc.internal.util.dao.QueryException: Table 'mysqlschema.portal_authorisationcode' doesn't exist