小编Gok*_*enG的帖子

Hibernate/JPA import.sql utf8字符已损坏

我正在使用import.sql将我的开发数据写入DB.我正在使用MySQL Server 5.5,我的persistence.xml在这里:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="MobilHM" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>tr.com.stigma.db.entity.Doctor</class>
    <class>tr.com.stigma.db.entity.Patient</class>
    <class>tr.com.stigma.db.entity.Record</class>
    <class>tr.com.stigma.db.entity.User</class>
    <properties>
        <property name="hibernate.hbm2ddl.auto" value="create" />
        <property name="hibernate.show_sql" value="true" />
        <property name="hibernate.format_sql" value="true" />
        <!-- Auto detect annotation model classes -->
        <property name="hibernate.archive.autodetection" value="class" />
        <!-- Datasource -->
        <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
        <property name="hibernate.connection.username" value="mobilhm" />
        <property name="hibernate.connection.password" value="mobilhm" />
        <property name="hibernate.connection.url" value="jdbc:mysql://localhost/mobilhm" />
        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
    </properties>
</persistence-unit>
Run Code Online (Sandbox Code Playgroud)

我的import.sql中的某些字符在DB中未正确显示.例如,字符ü在db中变为ü.mysql中的默认字符集是utf-8,我正在创建表格

CREATE TABLE doctor (doctorId int unsigned NOT NULL AUTO_INCREMENT, name …
Run Code Online (Sandbox Code Playgroud)

hibernate utf-8 character-encoding

12
推荐指数
1
解决办法
7608
查看次数

Intellij Idea 13 SVN访问Svn工作副本数据库

我今天安装了Intellij Idea 13.我已经有了maven/svn项目.使用Idea 13打开它们会给我带来数百条错误信息:

07:15:41访问svn工作副本数据库时发生了一些错误.

在事件日志上.

同样在"更改"选项卡上的"Subversion工作副本信息"选项卡上,有一些条目,如:

URL:svn:E200030:表达式无效

格式:未知更改

深度:未知

我在我的电脑上使用TortoiseSvn版本信息:

TortoiseSVN 1.7.11,Build 23600 - 64 Bit,2012/12/12 19:08:52

Subversion 1.7.8,

apr 1.4.6

apr-utils 1.3.12

霓虹灯0.29.6

OpenSSL 1.0.1c 2012年5月10日

zlib 1.2.7

我怎么解决这个问题?

编辑:在idea.exe(32位一)我没有收到这些消息.在idea64.exe中,会发生这些错误.

svn intellij-idea

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

如何为 slf4j 标记配置 logback.xml 文件

我想org.slf4j.Marker在我的应用程序中使用。我已经有一个 logback.xml 文件,无需标记即可正常工作。Java代码是这样的:

    public class SimpleActivitiIntegrationService implements ActivitiIntegrationService {
        private static final Marker PROCESS_INTEGRATION_MARKER = MarkerFactory.getMarker("PROCESS_INT");
        private static final Logger LOGGER = LoggerFactory.getLogger(SimpleActivitiIntegrationService.class);
        ...
        public void sendRequest(String s) throws RuntimeException {
            LOGGER.debug(PROCESS_INTEGRATION_MARKER, "Method started:%s", "sendRequest");
    }
}
Run Code Online (Sandbox Code Playgroud)

文件logback.xml是这样的:

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${log.path}/${log.file.name}.${log.file.extension}</file>

    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <!-- daily rollover -->
        <fileNamePattern>
            ${log.path}/${archieve.dir.name}/${log.file.name}.%d{yyyy-MM-dd}.%i.${log.file.extension}
        </fileNamePattern>

        <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
            <!-- or whenever the file size reaches 10MB -->
            <maxFileSize>10MB</maxFileSize>
        </timeBasedFileNamingAndTriggeringPolicy>

        <!-- keep 30 days' worth of history -->
        <maxHistory>30</maxHistory>
    </rollingPolicy>

    <encoder>
        <pattern> …
Run Code Online (Sandbox Code Playgroud)

logging logback slf4j

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

Eclipse:"声明的包与预期的包不匹配",但buildpath确实定义了声明的包

在一个名为my-projecteclipse 的maven项目中,eclipse一直在告诉我

声明的包"com.myself"与预期的包"main.java.com.myself"不匹配

虽然我在项目的构建路径中验证了,但我有一个条目:

my-project/src/main/java
    Included: **/*.java
    Excluded: (None)
    Native library location: (None)
    Ignore optional compile problems: No
Run Code Online (Sandbox Code Playgroud)

那可能是什么问题呢?

解决问题的最简单方法是什么?

我怀疑eclipse设置文件有问题,因为在将项目导入工作区并将其转换为maven项目之后,我不得不手动更改文件夹结构以获得maven web项目的常规文件夹结构.但可能是在这些变化期间,日食无法正确理解某些东西.

此外,maven能够构建我的项目(从eclipse以及命令行).

我刚刚从eclipse中获得了那些编译错误.

PS我已经尝试了项目>干净,但它没有帮助.

eclipse buildpath maven

4
推荐指数
1
解决办法
8893
查看次数

ph-schematron 验证错误信息

我正在使用ph-schematron来验证我的 XML 文件。我能够正确验证文件,但找不到如何生成有关失败断言的报告。

这是我的背景(兴趣点):

<bpmn:extensionElements>
    <activiti:in sourceExpression="RESERVATION" target="OPERATION_CODE"/>
    <activiti:in sourceExpression="true" target="IS_SYNC"/>
</bpmn:extensionElements>
Run Code Online (Sandbox Code Playgroud)

这是我的 Schematron 架构:

<iso:schema
    xmlns="http://purl.oclc.org/dsdl/schematron"
    xmlns:iso="http://purl.oclc.org/dsdl/schematron"
    queryBinding='xslt2'
    schemaVersion='ISO19757-3'>
    <iso:title>Test ISO schematron file. Introduction mode</iso:title>
    <iso:ns prefix='bpmn' uri='http://www.omg.org/spec/BPMN/20100524/MODEL'/>
    <iso:ns prefix='activiti' uri='http://activiti.org/bpmn'/>

    <iso:let name="callActivity" value="bpmn:definitions/bpmn:process/bpmn:callActivity"/>
    <iso:let name="inSourceExpression" value="child::activiti:in/sourceExpression"/>
    <iso:let name="outSourceExpression" value="child::activiti:out/sourceExpression"/>
    <iso:let name="inTarget" value="child::activiti:in/target"/>
    <iso:let name="outTarget" value="child::activiti:out/target"/>

    <!-- Your constraints go here -->
    <iso:pattern id="RESERVATION">
        <iso:p>
        This pattern validates call activities with RESERVATION operation code.
        </iso:p>
        <iso:rule context="$callActivity[bpmn:extensionElements/activiti:in[(@target='OPERATION_CODE') and (@sourceExpression='RESERVATION')]]/bpmn:extensionElements">
            <iso:assert test="count(($inSourceExpression='RESERVATION') and ($inTarget='OPERATION_CODE')) = 0">err1</iso:assert>
            <iso:assert test="count(($inSourceExpression='true') …
Run Code Online (Sandbox Code Playgroud)

java xml validation schematron

4
推荐指数
1
解决办法
865
查看次数

我们第二次写文件时用新内容替换文本文件的旧内容

嗨我正在通过java代码将一些数据写入文本文件但是当我再次运行代码时它再次附加到旧数据,我希望新数据覆盖旧版本.任何人都可以帮忙..

BufferedWriter  out1 = new BufferedWriter(new FileWriter("inValues.txt" , true));
  for(String key: inout.keySet())
                {
                    String val = inout.get(key);
                    out1.write(key+" , "+val+"\n");
                }
                out1.close();
Run Code Online (Sandbox Code Playgroud)

java

0
推荐指数
1
解决办法
1508
查看次数