有谁知道Eclipse中是否有快捷键" go to line + column " ?
我遇到了这个问题:
java.lang.String cannot be cast to java.lang.Enum
Run Code Online (Sandbox Code Playgroud)
当我尝试这个HQL时:
...
query = em.createQuery("SELECT object from Entity object where object.column = ?");
query.setParameter(1, "X");
return query.getResultList();
Run Code Online (Sandbox Code Playgroud)
在DB中,类型是带有检查约束的Varchar2(x),实体中的变量使用标签@Enumerated(EnumType.STRING)使用Enum定义:
public enum ColumnEnum {
X, Y;
}
Run Code Online (Sandbox Code Playgroud) 我试图使用staruml在序列图中显示参数
是否可以显示这样的参数?
1: saveResult(int value)
Run Code Online (Sandbox Code Playgroud) 我正在使用它dependency:analyze来检测依赖性问题.但我发现传递依赖项存在问题,因为插件无法解析此依赖项.
当我执行mvn dependency:tree时,输出显示传递依赖项.
依赖
project A
dependency B
project C
dependency A
Run Code Online (Sandbox Code Playgroud)
Outuput - >(项目C - 路径)/ mvn clean install
[WARNING] Used undeclared dependencies found:
dependency B: compile
Run Code Online (Sandbox Code Playgroud)
插入
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>analyze</id>
<phase>verify</phase>
<goals>
<goal>analyze-only</goal>
</goals>
<configuration>
<failOnWarning>true</failOnWarning>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
为什么插件不会检测传递依赖性
是否可以在运行时将HSQL语句转换为使用EntityManager的SQL?
我找到了这个解决方案,但我没有sessionFactory,我有EntityManager
protected String toSql(String hqlQueryText) {
if (sessionFactory != null && hqlQueryText != null && hqlQueryText.trim().length() > 0) {
final QueryTranslatorFactory translatorFactory = new ASTQueryTranslatorFactory();
final SessionFactoryImplementor factory = (SessionFactoryImplementor) sessionFactory;
final QueryTranslator translator = translatorFactory.createQueryTranslator(hqlQueryText, hqlQueryText,
Collections.EMPTY_MAP, factory);
translator.compile(Collections.EMPTY_MAP, false);
return translator.getSQLString();
}
return null;
}
Run Code Online (Sandbox Code Playgroud) 我正在使用插件在另一个模块的测试中附加测试.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
在需要jar的模块中:
<dependency>
<groupId>com.myco.app</groupId>
<artifactId>foo</artifactId>
<version>1.0-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
它对我来说非常有用,但是我发现了一个问题:当我执行"clean install -Dmaven.test.skip = true"时,还需要依赖test-jar并且进程失败