我正在阅读Spring Data JPA Tutorial.我很困惑这个框架如何在内部工作.让我说明具体情况
有特定的代码
/**
* Custom finder
*/
public List<Location> getLocationByStateName(String name) {
@SuppressWarnings("unchecked")
List<Location> locs = entityManager
.createQuery("select l from Location l where l.state like :state")
.setParameter("state", name + "%").getResultList(); // note
return locs;
}
Run Code Online (Sandbox Code Playgroud)
这只是由以下界面取代
@Repository
public interface LocationJPARepository extends JpaRepository<Location, Long> {
List<Location> findByStateLike(String stateName);
}
Run Code Online (Sandbox Code Playgroud)
相应的测试用例运行良好
@Test
public void testFindWithLike() throws Exception {
List<Location> locs = locationRepository.getLocationByStateName("New");
assertEquals(4, locs.size());
}
Run Code Online (Sandbox Code Playgroud)
新的测试案例
@Test
public void testFindWithLike() throws Exception {
List<Location> locs = locationJPARepository.findByStateLike("New"); …Run Code Online (Sandbox Code Playgroud) 在我的项目中我有
<bean id="ABCSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="ABCDataSource" />
<property name="mapperLocations">
<list>
<value>classpath:com/myco/dao/XYZMapper.xml</value>
</list>
</property>
<bean>
Run Code Online (Sandbox Code Playgroud)
和
log4j.logger.java.sql.Connection=debug, stdout, abclog
log4j.logger.java.sql.PreparedStatement=debug, stdout, abclog
log4j.logger.java.sql=debug, stdout, abclog
log4j.logger.org.mybatis=debug, stdout, abclog
log4j.logger.org.apache.ibatis=debug, stdout, abclog
Run Code Online (Sandbox Code Playgroud)
当我在日志中运行applicartion时,我没有看到SQL查询想知道我错过了什么
看到这篇文章如何为Mybatis配置log4j以打印我的SQL 建议更改mybatis类配置但不确定如何处理spring SqlSessionFactoryBean
我知道关于linkedHashSet的一些事情
我知道如果使用散列,那么存储的概念就会出现
但是,通过检查JDK中的代码,似乎LinkedHashSet实现只包含构造函数而没有实现,所以我猜所有的逻辑都发生在HashSet中?
让我以这种方式提出我的问题......如果客观是写一个集合
看到一个类似的问题HashSet和LinkedHashSet之间的区别是什么,但不是很有帮助
如果我需要更多地解释我的问题,请告诉我
在接受采访时被问到这个问题,试图解决它......但没有成功.我想过使用CyclicBarrier
有三个线程T1打印1,4,7 ... T2打印2,5,8 ...和T3打印3,6,9 .... 如何将这三个同步到打印顺序1,2,3,4,5,6,7,8,9 ....
我尝试编写并运行以下代码
public class CyclicBarrierTest {
public static void main(String[] args) {
CyclicBarrier cBarrier = new CyclicBarrier(3);
new Thread(new ThreadOne(cBarrier,1,10,"One")).start();
new Thread(new ThreadOne(cBarrier,2,10,"Two")).start();
new Thread(new ThreadOne(cBarrier,3,10,"Three")).start();
}
}
class ThreadOne implements Runnable {
private CyclicBarrier cb;
private String name;
private int startCounter;
private int numOfPrints;
public ThreadOne(CyclicBarrier cb, int startCounter,int numOfPrints,String name) {
this.cb = cb;
this.startCounter=startCounter;
this.numOfPrints=numOfPrints;
this.name=name;
}
@Override
public void run() {
for(int counter=0;counter<numOfPrints;counter++)
{
try {
// System.out.println(">>"+name+"<< "+cb.await()); …Run Code Online (Sandbox Code Playgroud) 我试图在JSON中使用矩阵样式数据,但它似乎不起作用.谁能帮我理解我做错了什么?
{
"took": 12,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 44,
"max_score": 1,
"hits": [
{
"_index": "transactions",
"_type": "transaction",
"_id": "trans0007",
"_score": 1,
"_source": {
"fundRelation": "[1,0,0,1,0,0,1,0,1,1,0,1,0,1,1,1,0,1,0,0],
[0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,0],
[0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[1,0,0,1,0,0,1,0,0,1,0,1,0,1,1,1,0,1,0,0],
[0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0],
[0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0],
[0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0],
[0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0],
[1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,1,1,0],
[1,0,0,1,0,0,1,0,1,1,0,1,0,1,0,1,0,1,1,0],
[1,0,0,1,0,0,1,0,1,1,0,1,0,1,1,0,0,1,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0],
[0,0,1,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0],
[0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0],
[0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0]
",
"fundName": ["Fund A","Fund B","Fund C","Fund D","Fund E","Fund F","Fund G","Fund H","Fund I","Fund J","Fund K","Fund L","Fund M","Fund N","Fund O","Fund P","Fund Q","Fund R","Fund S","Fund T"],
"fundColor": ["#9ACD32","#377DB8","#F5DEB3","#EE82EE","#40E0D0","#FF6347","#D8BFD8","#D2B48C","#4682B4","#00FF7F","#FFFAFA","#708090","#708090","#6A5ACD","#87CEEB","#A0522D","#FFF5EE","#2E8B57","#F4A460","#FA8072"] …Run Code Online (Sandbox Code Playgroud) 我有这样的UI

它使用com.extjs.gxt.ui.client.widget.form.DateField 在Date的"change"事件中我有一个监听器.这里的问题是
我的问题是我只想在更改日期值时调用我的代码,而无需用户点击外面...有没有办法?
我正在使用SonarQube版本6.7.1
我正在尝试为我们的项目获取JSON响应sonarQube统计信息只需要简单的细节,例如
可能是我没有清楚地阅读/理解文档,可能是指向教程或示例的指针或其他一些指针会帮助我,
我是kubernetes新手,我有一个基本问题
我对https://kubernetes.io/docs/reference/kubectl/conventions/的理解是,我们可以使用“ kubernetes run”命令生成yaml模板
不知道我的理解是错误的还是命令中的错误
在声纳中,我看到了代码的重大违规警告
public Long getValue(FieldType fieldType) {
Long value = paramLevelMap.get(fieldType); // ok returns Long not long
return value == null ? UNSPECIFIED_PARAMETER_KEY : value; // complaints here
}
Run Code Online (Sandbox Code Playgroud)
其中'UNSPECIFIEDpa_PARAMETER_KEY'是pvt static long,'value'也很长.
盒装值未装箱,然后立即重新装箱
它在第二行抱怨.我不太明白它,何时原始长度被转换为相应的类对象?然后回来 ?
我有一个 linux 上的 Maven 项目。直到上周,它都建设得很好。今天我遇到以下错误
[ERROR] Failed to execute goal on project my-integration-service: Could not resolve
dependencies for project com.mycompany.myproj:my-integration-service:jar:0.0.1-SNAPSHOT:
Failed to collect dependencies for [org.springframework:spring-core:jar:4.0.4.RELEASE
(compile), org.springframework:spring-tx:jar:4.0.4.RELEASE (compile), ...]: No versions
available for joda-time:joda-time:jar:[2.2,) within specified range -> [Help 1]
Run Code Online (Sandbox Code Playgroud)
我检查了我的 settings.xml ,在本地存储库中我可以看到这个的许多版本...库 2.2 , 2.4 ... 2.9.1
我还看到了文件 M2_REPO/joda-time/joda-time/resolver-status.properties
maven-metadata-codehaus.xml.error=Could not transfer metadata joda-time\:joda-time/maven-metadata.xml from/to codehaus (http\://repository.codehaus.org/org/codehaus)\: Error transferring file\: repository.codehaus.org
...
maven-metadata-spring-milestone.xml.error=Could not transfer metadata joda-time\:joda-time/maven-metadata.xml from/to spring-milestone (http\://maven.springframework.org/milestone)\: Error transferring file\: Connection reset
....
maven-metadata-com.springsource.repository.maven.releases.xml.error=Could not …Run Code Online (Sandbox Code Playgroud) 我在 CodeCommmit 中有一个非常简单的 Hello World Java 项目,具有以下结构
\n\nThis is a sample template for sam-app - Below is a brief explanation of what we have generated for you:\n\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 README.md <-- This instructions file \n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 HelloWorldFunction <-- Source for HelloWorldFunction Lambda Function \n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 pom.xml <-- Java dependencies \n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 src \n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 main \n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 java \n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 helloworld \n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 App.java <-- Lambda function code \n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 GatewayResponse.java <-- POJO for API Gateway Responses object …Run Code Online (Sandbox Code Playgroud) 我正在通过 Java 的 HashMap hash() 实现,如下所示
final int hash(Object k) {
// some checks
h ^= k.hashCode();
// This function ensures that hashCodes that differ only by
// constant multiples at each bit position have a bounded
// number of collisions (approximately 8 at default load factor).
h ^= (h >>> 20) ^ (h >>> 12);
return h ^ (h >>> 7) ^ (h >>> 4);
// >>> is Unsigned right shift
}
Run Code Online (Sandbox Code Playgroud)
我不确定为什么添加下面的代码,以及相同的好处是什么?
h ^= (h >>> 20) ^ …Run Code Online (Sandbox Code Playgroud) java ×5
collections ×2
hash ×2
sonarqube ×2
spring ×2
autoboxing ×1
aws-lambda ×1
devops ×1
gwt ×1
gxt ×1
hashmap ×1
ibatis ×1
jpa ×1
json ×1
kubectl ×1
kubernetes ×1
log4j ×1
logging ×1
matrix ×1
maven ×1
mybatis ×1
spring-data ×1