有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java无实体生成与hibernate上的逆向工程

我在Hibernate上遇到了一个逆向工程问题

我的pom中有这个依赖项,只有这两个

<dependencies>
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>5.2.11.Final</version>
</dependency>
<dependency>
    <groupId>org.mariadb.jdbc</groupId>
    <artifactId>mariadb-java-client</artifactId>
    <version>2.1.2</version>
</dependency>
</dependencies>

我把这个当成冬眠。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">org.mariadb.jdbc.Driver</property>
    <property name="hibernate.connection.password">toto</property>
    <property name="hibernate.connection.url">jdbc:mariadb://127.0.0.1:3306/</property>
    <property name="hibernate.connection.username">titi</property>
    <property name="hibernate.dialect">org.hibernate.dialect.MariaDB53Dialect</property>
</session-factory>
</hibernate-configuration>

我冬眠了。xml看起来像

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >

<hibernate-reverse-engineering>
   <table-filter match-catalog="boutique" match-name="caracterise"/>
   <table-filter match-catalog="boutique" match-name="caracteristiques"/>
   <table-filter match-catalog="boutique" match-name="categories"/>
   <table-filter match-catalog="boutique" match-name="clients"/>
   <table-filter match-catalog="boutique" match-name="commentaires"/>
   <table-filter match-catalog="boutique" match-name="commente"/>
   <table-filter match-catalog="boutique" match-name="contient"/>
   <table-filter match-catalog="boutique" match-name="fournis"/>
   <table-filter match-catalog="boutique" match-name="fournisseurs"/>
   <table-filter match-catalog="boutique" match-name="marques"/>
   <table-filter match-catalog="boutique" match-name="nomcaracteristique"/>
   <table-filter match-catalog="boutique" match-name="paniers"/>
   <table-filter match-catalog="boutique" match-name="produits"/>
</hibernate-reverse-engineering>

当我运行“Hibernate代码生成配置”时,计算机会运行一段时间,但我没有生成任何代码,也没有收到任何错误消息

我的所有文件都是在eclipse oxygen和jdk1上使用jboss工具4.5.0 final自动生成的。debian 9上的8.0_144 32位

在错误日志框中,我现在收到了这条消息

org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
        org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
        Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
        org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
        Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

共 (1) 个答案

  1. # 1 楼答案

    您可以尝试控制台配置。我使用的是DevStudio,所以我不完全确定这是否与氧气上的jboss工具相同,尽管我知道DevStudio使用jboss工具

    jboss tools configuration