小编Cri*_*ina的帖子

Hibernate 4未设置'hibernate.dialect'时,对DialectResolutionInfo的访问不能为空

我正在使用Hibernate最新版本4.3.5.Final.

我的hibernate.cfg.xml文件内容:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://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.url">jdbc:mysql://localhost/Test</property>
    <property name="hibernate.connection.username">pankaj</property>
    <property name="hibernate.connection.password">xxxx</property>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>

    <mapping resource="employee.hbm.xml"/>
</session-factory>

</hibernate-configuration>
Run Code Online (Sandbox Code Playgroud)

用于创建SessionFactory的实用程序类:

package com.example;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {

private static final SessionFactory sessionFactory = buildSessionFactory();

private static SessionFactory buildSessionFactory() {
    try {
        // Create the SessionFactory from hibernate.cfg.xml
        Configuration configuration = new Configuration();
        configuration.configure("hibernate.cfg.xml");
        System.out.println("Hibernate Configuration loaded");

        SessionFactory sessionFactory = configuration.buildSessionFactory(new StandardServiceRegistryBuilder().build()); …
Run Code Online (Sandbox Code Playgroud)

java hibernate

11
推荐指数
2
解决办法
4万
查看次数

jaxb 依赖项的 Java 11 问题

我正在尝试将一个项目的 Java 8 版本升级到 11,在手动添加 JAXB 依赖项后,在构建时遇到以下错误:

'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} in com.sun.xml.bind:jaxb-impl:2.2.11
Run Code Online (Sandbox Code Playgroud)

我正在使用 Gradle,所以我添加了以下依赖项:

implementation "javax.xml.bind:jaxb-api:2.2.11"
implementation "com.sun.xml.bind:jaxb-core:2.2.11"
implementation "com.sun.xml.bind:jaxb-impl:2.2.11"
implementation "javax.activation:activation:1.1.1"
Run Code Online (Sandbox Code Playgroud)

我试图搜索 jaxb pom 以搜索它正在寻找的属性 ( tools.jar) 被指定但找不到任何东西的地方。

我究竟做错了什么?

java gradle

11
推荐指数
2
解决办法
7725
查看次数

从angularjs ui-grid菜单中删除聚合菜单项

ui-grid官方网站(例如上http://ui-grid.info/docs/#/tutorial/209_grouping)提出了一种分组功能,它看起来像这样: 在此输入图像描述

我想要Grouping菜单项,但没有Aggregate列菜单中的那些(计数,总和,最大值,最小值,平均值),我找不到解除它们的方法.

我试过的解决方案是uiGridGroupingService通过为groupingColumnBuilder提供装饰器来覆盖它,但是服务根本没有解决,我不禁想知道是否有更简单的方法来实现这一点.

有人知道这个问题的任何解决方案吗?

angularjs angular-ui-grid

9
推荐指数
3
解决办法
3976
查看次数

使用nativeQuery的Spring Boot Query注释在Postgresql中不起作用

发展环境.

OS: windows 8
IDE : Eclipse Luna with JAVA 8
Postgresql : 9.3.4 in OPENBSD 5.5
Run Code Online (Sandbox Code Playgroud)

其他所有JPA查询,如findFirst3ByTextOrderByTextAsc正常工作.但不是在NativeQuery中,特别是在INTERVAL中

知识库

@RepositoryRestResource(collectionResourceRel = "Nodes", path = "Nodes")
public interface NodeRepository extends 
JpaRepository<Node, Integer>, 
CrudRepository<Node, Integer>,
PagingAndSortingRepository<Node, Integer>,
Repository<Node, Integer>
{
    //1st INTERVAL is native keyword in POSTGRESQL
    @Query(value = "SELECT n.* from nodes n WHERE n.node_id = 10510 AND n.last_good_ping > CURRENT_DATE - INTERVAL '1 day' ", nativeQuery = true)
    List<Node> getLast24HoursByNodeId();

    //2nd
    @Query(value = "SELECT n.* from nodes n WHERE n.node_id …
Run Code Online (Sandbox Code Playgroud)

sql postgresql spring-data spring-data-jpa spring-boot

6
推荐指数
1
解决办法
3744
查看次数

有没有办法在基于注释的MyBatis/iBatis中重用SQL片段?

MyBatis 在基于XML的定义中具有可重用SQL片段的这一强大功能,例如:

<mapper namespace="com.company.project.dao.someDao">

    <sql id="whereDate">
        WHERE date(`time`) BETWEEN #{startDate} AND #{endDate}
    </sql>  

    <sql id="someOtherSqlFragment">
        ...
    </sql>

    <select id="getSomeData"
            resultType="SomeClass"
            parameterType="DateParam" >
        SELECT some_column, another_column
    </select>

        FROM some_table

        <include refid="whereDate"/>

        <include refid="otherSqlFragment"/>

    </select>

</mapper>
Run Code Online (Sandbox Code Playgroud)

有没有办法在基于注释的查询定义中定义和使用这些片段,还是没有办法解决这个问题?

java annotations ibatis mybatis

5
推荐指数
1
解决办法
614
查看次数

排除 Gradle 插件的传递依赖

在 Gradle 中排除传递依赖非常简单:

compile('com.example.m:m:1.0') {
     exclude group: 'org.unwanted', module: 'x'
  }
Run Code Online (Sandbox Code Playgroud)

我们将如何解决我们使用插件的情况:

apply: "somePlugin"
Run Code Online (Sandbox Code Playgroud)

当获取依赖项时,我们意识到该插件带来了自己的一些传递依赖项?

java gradle

5
推荐指数
2
解决办法
5355
查看次数

变量'dim'(不是数组)周围的堆栈已损坏

我正在尝试使用fstream读取二进制文件,我之前在那里写过一些数据.

问题是在到达函数结束后,将显示主题中的消息

代码如下:

ifstream in("contrib.bin", ios::in | ios::binary );

char *nume, dim;
in.read((char*)&dim, sizeof(int));
nume = new char[dim + 1];
in.read(nume, dim);
nume[dim] = '\0';
double imp;
in.read((char*)&imp, sizeof(double));

delete [] nume;
Run Code Online (Sandbox Code Playgroud)

现在,我已完成我的作业并寻找这个问题,但面对它的其他人有数组,而我的变量是一个简单的字符.

有人能指出我正确的方向吗?

c++ fstream corrupt visual-studio-2010

2
推荐指数
2
解决办法
257
查看次数