格式化日期后我显示时间显示上午或下午(大写)我希望它在小写像上午,下午这是我的代码
public class Timeis {
public static void main(String s[]) {
long ts = 1022895271767L;
String st = null;
st = new SimpleDateFormat(" MMM d 'at' hh:mm a").format(ts);
System.out.println("time is " + ts);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试跟随hql查询执行
SELECT count(*)
FROM BillDetails as bd
WHERE bd.billProductSet.product.id = 1002
AND bd.client.id = 1
Run Code Online (Sandbox Code Playgroud)
但它正在显示
org.hibernate.QueryException: illegal attempt to dereference collection
[billdetail0_.bill_no.billProductSet] with element property reference [product]
[select count(*) from iland.hbm.BillDetails as bd where bd.billProductSet.product.id=1001 and bd.client.id=1]
at org.hibernate.hql.ast.tree.DotNode$1.buildIllegalCollectionDereferenceException(DotNode.java:68)
at org.hibernate.hql.ast.tree.DotNode.checkLhsIsNotCollection(DotNode.java:558)
Run Code Online (Sandbox Code Playgroud) 是否冬眠转换column != null在HQL到column is null在SQL?
以下代码:
Calendar now = Calendar.getInstance();
month = now.get(Calendar.MONTH) + 1;
year = now.get(Calendar.YEAR);
System.out.println("Month " + month + " year " + year);
SimpleDateFormat dt1 = new SimpleDateFormat("MMMM YYYY");
e.setMonthnYear(dt1.format(now.getTime()));
Run Code Online (Sandbox Code Playgroud)
在服务器上部署后显示以下异常:
java.lang.IllegalArgumentException: Illegal pattern character 'Y'
java.text.SimpleDateFormat.compile(SimpleDateFormat.java:768)
java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:575)
java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:500)
java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:475)
iland.employee.EmployeeAction.fetchAllAtted(EmployeeAction.java:169)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
Run Code Online (Sandbox Code Playgroud)
在我使用的本地主机上JDK v1.8,上面的代码工作正常,但在服务器上它无法正常工作.
我该如何解决这个问题?
我正在尝试打印uint16_t和uint32_t值,但它没有提供所需的输出.
#include <stdio.h>
#include <netinet/in.h>
int main()
{
uint32_t a=12,a1;
uint16_t b=1,b1;
a1=htonl(a);
printf("%d---------%d",a1);
b1=htons(b);
printf("\n%d-----%d",b,b1);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我也用过
printf("%"PRIu32, a);
Run Code Online (Sandbox Code Playgroud)
这显示错误.
如何打印这些值以及所需的输出?
我正在尝试编写一个单元测试类,它必须使用相同的查询在同一测试方法中从数据库中获取结果两次.但是,当第二次启用Hibernate缓存时,它实际上并没有访问数据库,只是从缓存中获取结果.
有人可以回答如何禁用缓存persistence.xml.
我试图通过更改属性来禁用 hibernate.cache.use.query_cache = false 和hibernate.cache.use_second_level_cache = false.
但它没有用.
我想在Hibernate中执行以下查询?
select count(*) from login where emailid='something' and password='something'
有什么区别col-lg,col-md,col-xs并col-sm在网格系统自举3.
在引导程序模板中,它们<div class="col-lg-6 col-md-6 col-xs-12 col-sm-6"></div>仅用于一个列网格.我是Bootstrap的初学者.
以下是我的代码在这里,我使用多个列表从数据库中获取数据.从hql查询中获取数据时,它显示异常.
Pojo类
public class BillDetails implements java.io.Serializable {
private Long billNo;
// other fields
@LazyCollection(LazyCollectionOption.FALSE)
private List<BillPaidDetails> billPaidDetailses = new ArrayList<BillPaidDetails>();
private Set productReplacements = new HashSet(0);
@LazyCollection(LazyCollectionOption.FALSE)
private List<BillProduct> billProductList = new ArrayList<BillProduct>();
//getter and setter
}
Run Code Online (Sandbox Code Playgroud)
hmb.xml文件
<class name="iland.hbm.BillDetails" table="bill_details" catalog="retail_shop">
<id name="billNo" type="java.lang.Long">
<column name="bill_no" />
<generator class="identity" />
</id>
<bag name="billProductList" table="bill_product" inverse="true" lazy="false" fetch="join">
<key>
<column name="bill_no" not-null="true" />
</key>
<one-to-many class="iland.hbm.BillProduct" />
</bag>
<bag name="billPaidDetailses" table="bill_paid_details" inverse="true" lazy="false" fetch="select">
<key>
<column name="bill_no" not-null="true" /> …Run Code Online (Sandbox Code Playgroud) 我存储java.sql.Timestamp在PostgreSQL的数据库作为时间戳数据类型,我想找出从存储在数据库中,以当前的一个在几分钟或几小时的差额时间戳.这样做的最佳方法是什么?是否有内置的方法或我必须将其转换为长或什么?