我正在尝试使用此处的示例来学习Hibernate-Spring-Struts .
但在创建pom.xml获取此错误后:
Missing artifact javax.transaction:jta:jar:1.0.1B
Run Code Online (Sandbox Code Playgroud)
我仅在创建pom.xml文件方面取得了进展,并进行了更改以包含最新的库.这是我的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>S3HMaven</groupId>
<artifactId>S3HMaven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>S3HMaven</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.0.1B</version>
</dependency>
<!-- Struts 2 -->
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.1.8</version>
</dependency>
<!-- Struts 2 + Spring plugins -->
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.3.15.2</version>
</dependency>
<!-- MySQL database driver -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.26</version>
</dependency>
<!-- Spring framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId> …Run Code Online (Sandbox Code Playgroud) 我需要帮助创建嵌套对象的hibernate标准.例如 :
class office{
Integer id;
OfficeDetails cmdData ;
}
class OfficeDetails {
Integer id;
Region region;
}
class Region {
Integer id;
Integer regionNum;
}
Run Code Online (Sandbox Code Playgroud)
现在,从服务类(officeService),我试图将所有与某个地区相匹配的办公室拉出来:
List<Office> findAllByRegion( Integer regionNumber){
def criteria = { eq ( 'cmdData.region.regionNum', regionNumber ) }
def allOfficesInTheRegion = Office.findAll(criteria)
return allOfficesInTheRegion
}
Run Code Online (Sandbox Code Playgroud)
总是得到异常:"org.hibernate.QueryException:无法解析属性:"我需要找到正确的方法来为此查询创建条件.任何人都可以帮忙吗?
这就是它在project-> properties-> java Build Path-> source选项卡中的样子.不知道我缺少什么,但/ target/classes文件夹没有显示在"项目资源管理器"视图中.有人可以帮忙吗?

对于 jdk 8,我的步骤是计算进程运行时消耗了多少内存:
/usr/java/latest/bin>: ./jps
27116 Main
7591 Jps
2879 AmbusProcessor
Run Code Online (Sandbox Code Playgroud)
然后获取进程 ID 来检查堆的状态:
/usr/java/latest/bin>: ./jmap -heap 2879
Attaching to process ID 2879, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.45-b08
using thread-local object allocation.
Parallel GC with 13 thread(s)
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 68719476736 (65536.0MB)
NewSize = 1310720 (1.25MB)
MaxNewSize = 17592186044415 MB
OldSize = 5439488 (5.1875MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 21757952 (20.75MB)
MaxPermSize = …Run Code Online (Sandbox Code Playgroud) Map<Integer, String> map = new HashMap<>();
map.put(1, "f");
map.put(2, "i");
map.put(3, "a");
map.put(4, "c");....etc
Run Code Online (Sandbox Code Playgroud)
现在我有一个列表:
List<Integer> picks = {1,3}
Run Code Online (Sandbox Code Playgroud)
我想取回一个字符串列表,即映射中与“ pick”列表中找到的键值匹配的值。因此,我希望取回{“ f”,“ a”}作为结果。有没有一种方法可以使用Java流api优雅地做到这一点?
当有一个值时,我就是这样:
map.entrySet().stream()
.filter(entry -> "a".equals(entry.getValue()))
.map(entry -> entry.getValue())
.collect(Collectors.toList())
Run Code Online (Sandbox Code Playgroud)
但是,当要过滤的键/小贴士列表变得越来越困难时。
试图覆盖Html.TextBoxFor(MVC 3)的"id"属性,使它看起来像:
<input type="text" name="Password" id="@idPasswordTextBox" value="@Model.Password" />
Run Code Online (Sandbox Code Playgroud)
其中"idPasswordTextBox"定义为:
string idPasswordTextBox = "passwordText_"+@Model.Key;在同一个cshtml文件中.
如果我用作:
<input type="text" name="Password" id="@idPasswordTextBox" value="@Model.Password" />
Run Code Online (Sandbox Code Playgroud)
但如果我这样做,就无法工作:
@Html.TextBoxFor(model => model.Password, new { id = "@idPasswordTextBox" })
Run Code Online (Sandbox Code Playgroud)
看起来"id"属性搞砸了.我错过了什么?有人可以帮忙吗?我是ASP.net的新蜜蜂.
提前致谢.
我正在使用JDK 1.7和Eclipse并尝试连接两个字符串数组:
String [] a1 = { "a12", "b12" };
String [] a2 = { "c12", "d23", "ewe", "fdfsd" };
Run Code Online (Sandbox Code Playgroud)
我试过了
String[] both = ObjectArrays.concat(a1,a2,String.class);
Run Code Online (Sandbox Code Playgroud)
进口
import com.google.common.collect.ObjectArrays;
Run Code Online (Sandbox Code Playgroud)
得到错误:
can not resolve "import com.google.common.collect.ObjectArrays"
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?我正在使用Maven来构建项目.
我们正在从jdk 8迁移到openjdk11。我们的一些使用soap调用第三方api的项目均因错误而失败:
java.lang.NoClassDefFoundError: javax/xml/ws/handler/soap/SOAPHandler
Run Code Online (Sandbox Code Playgroud)
经过一些研究,我尝试通过添加依赖项:
[ 参考:
]
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.xml.soap</groupId>
<artifactId>javax.xml.soap-api</artifactId>
<version>1.3.5</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
不工作。我可以对替代方案有所了解吗?
很难为"OR"条件制作正则表达式.
示例:table有2列并尝试搜索第二列(比如说 - "status"列),搜索正则表达式是:
//javascript
$('#filter-status').change(function() {
searchTxt = "Not Shared|Private";
<table name>.dataTable().fnFilter(searchTxt , 2,true);
}
Run Code Online (Sandbox Code Playgroud)
看起来它正在通过"未共享"来提取数据,因为状态不会提取具有"私有"状态的数据.
甚至尝试使用searchTxt作为"^(不共享)|(私有)$"和"/(^不共享$)|(^私有$)/"
不确定我错过了什么.有人可以帮忙吗?
我正在尝试以 ( ) 格式获取日期的输出String:
\n\n\n20170801\xe2\x80\x8b \xe2\x80\x8b123030\xe2\x80\x8b \xe2\x80\x8b美国/洛杉矶
\n
但使用这段代码:
\n\nSimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd hhmmss Z", Locale.US);\nsdf.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));\nSystem.out.println(sdf.format(new java.util.Date()));\nRun Code Online (Sandbox Code Playgroud)\n\n我得到的输出为(注意区域部分):
\n\n\n\n\n20174904 024908 -0700
\n
知道如何修复它吗?我需要打印"\xe2\x80\x8bAmerica/Los_Angeles"而不是"-0700".