当我从XSD生成JAXB类时,元素maxOccurs="unbounded"会为它们生成一个getter方法,但是没有setter方法,如下所示:
/**
* Gets the value of the element3 property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the element3 property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getElement3().add(newItem);
* …Run Code Online (Sandbox Code Playgroud) 我想替换所有'.'和' '一个'_'
但我不喜欢我的代码......
是否有更有效的方法来做到这一点:
String new_s = s.toLowerCase().replaceAll(" ", "_").replaceAll(".","_");
Run Code Online (Sandbox Code Playgroud)
?
toLowerCase()就在那里,因为我希望它也更低......
在弹簧容器中,使用以下代码:
public class A {
@Transactional
public void m1() {
...
b.m2(); // call in a new transaction
...
}
}
public class B {
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void m2() {
...
}
}
Run Code Online (Sandbox Code Playgroud)
什么时候创建的交易完全m2()提交?一旦m2()调用结束,或一旦m1()调用结束?
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)什么时候提交?为EJB回答它,但它似乎与JPA不一样.
我调试了它,我只能m2()在m1()结束后看到DB 的效果,但这对我来说似乎很奇怪,我在这里错过了一些东西吗?
更新:
我将检索m1()到的实体传递给m2()并从那里更新.所以,实际上合并实体m2()解决了这个问题并且Mik378答案是正确的.
我在MS Access查询中遇到此错误: The number of columns in the two selected tables or queries of a union query do not match.
列数匹配清楚,当我运行UNION查询一次挑选任何2个集时,它工作正常.当我在查询中包含更多2选择时,它会显示此错误.
SELECT "Applied" as Application_Status, Count(*) AS [CountOfApplication Status]
FROM [EDB Applicants - ALL]
WHERE [EDB Applicants - ALL].[Application Year].Value Like "2012" And [EDB Applicants - ALL].[Application Date]<=Date()-366 And [EDB Applicants - ALL].[Dec Date]>Date()-366
UNION
SELECT "Hold" as Application_Status, Count(*) AS [CountOfApplication Status]
FROM [EDB Applicants - ALL]
WHERE [EDB Applicants - ALL].[Application Year].Value Like "2012" And [EDB Applicants - …Run Code Online (Sandbox Code Playgroud) 是否可以使用camel 属性组件将消息头设置为从属性文件读取的值?我可以将这些属性设置为URI选项,但我无法将它们设置为标头值.
我需要这样的东西:
<camel:setHeader headerName="actionId">
<camel:constant>{{onus.transPosting.RtSFailed}}</camel:constant>
</camel:setHeader>
Run Code Online (Sandbox Code Playgroud)
where onus.transPosting.RtSFailed是在使用camel Properties Component导入的文件上设置的属性键.
注意:我正在使用Apache Camel 2.10.1
UPDATE
使用此讨论<propertyPlaceholder>建议不起作用,它会导致异常:
Caused by: org.apache.camel.language.simple.types.SimpleParserException: Unknown function: onus.transPosting.RtSFailed
官方Java代码约定文档 - 我可以得到 - 是1997年,似乎Oracle没有它的更新版本.
Oracle实际上在约定页面上声明:
此页面上的信息仅适用于存档目的
此页面未被主动维护.文档中的链接可能不起作用,信息本身可能不再有效.该文件的最新修订版于1999年4月20日作出
是否有更新的官方或至少事实上的官方公约?
注意:我不要求在这里讲好或最好的约定,我问了更新的标准或者在如果任何事实上的标准.所以,答案不应该是基于意见的答案.
我正在使用我的程序中包含的SQL文件,一旦我修复了一个问题,我就能在这里找到答案(谢谢)..我再次运行它并得到以下错误:
SQL查询:
# Create table structure for 'member' table
CREATE TABLE member(
memberID INT( 11 ) NOT NULL AUTO_INCREMENT ,
title VARCHAR( 80 ) NOT NULL DEFAULT '',
firstname VARCHAR( 80 ) NOT NULL DEFAULT '',
lastname VARCHAR( 80 ) NOT NULL DEFAULT '',
email VARCHAR( 80 ) NOT NULL DEFAULT '',
address VARCHAR( 80 ) NOT NULL DEFAULT '',
suburb VARCHAR( 80 ) NOT NULL DEFAULT '',
state VARCHAR( 80 ) NOT NULL DEFAULT '',
country VARCHAR( 80 ) …Run Code Online (Sandbox Code Playgroud) 我知道Java中不允许使用循环继承层次结构.编译器会抛出错误,但我真正感兴趣的是知道编译失败的确切原因.
class A extends B{}
class B extends C{}
class C extends A{} // this will give you compile time error.
Run Code Online (Sandbox Code Playgroud)
在我编写代码的那一刻,编译器将抛出错误的原因是什么 class C extends A{}
我试图检查字符串是否为"0","1","2",...,"9"而不将字符串转换为数字.有什么建议?现在我正在为每个人做一个.equals(),这很难看.
java ×7
apache-camel ×1
coding-style ×1
conventions ×1
hibernate ×1
inheritance ×1
java-ee ×1
jaxb ×1
jpa ×1
ms-access ×1
mysql ×1
spring ×1
string ×1
union ×1