@Converter(introduced since JPA2.1)
似乎是一种非常方便的方法,可以将数据库值切换到我们希望在java代码中看到的值.但是,我无法让这件事发挥作用.JPA似乎没有意识到我编写的转换器,并试图将值转换为适当的类本身.
这是我写的代码:
@Converter(autoApply = true)
public class DateConverter implements AttributeConverter<Date, String> {
@Override
public String convertToDatabaseColumn(Date b) {
System.out.println("Converting to Database Columns");
return "";
}
@Override
public Date convertToEntityAttribute(String string) {
System.out.println("Converting to Entity Attribute");
return new Date();
}
}
Run Code Online (Sandbox Code Playgroud)
模型中写的相应部分是:
@Entity
@Table(name = "test_table")
public class TestClass extends BaseModel {
private static final long serialVersionUID = 1L;
@Id
private Integer id;
@Convert(converter = DateConverter.class)
@Column(name = "is_dominant_project_unit_type")
private Date isDominantProjectUnitType;
public Integer getId() {
return id; …
Run Code Online (Sandbox Code Playgroud) 我在弹性搜索1.4.4上运行了Kibana 4.0.1.它非常流畅,几乎没有设置时间.突然间我遇到了一个问题.
如果我在弹性搜索索引中添加一个新字段,则在字段部分中不可见.我仍然可以在发现部分查询该字段.但是,我不能根据新字段制作图表,因为它在字段列表中不可见.
Kibana显然_mapping
在设置时获取并将其存储在名为的elasticsearch 索引中.kibana
.一旦完成,它永远不会改变.删除此索引应从_mapping
elasticsearch 加载新内容.但我不想丢失所有已保存的仪表板和可视化.
有没有强制定期Kibana
加载新鲜mapping
?
Spring
公司推出了新的注释@PropertySources
对标记为所有类@Configuration
自4.0
。它采用不同的@PropertySource
参数。
@PropertySources({
@PropertySource("classpath:application.properties"), @PropertySource("file:/tmp/application.properties")})
Run Code Online (Sandbox Code Playgroud)
我感兴趣的是,要知道多个属性文件中存在的同一键的值发生冲突时的排序。我还没有看到任何与此相关的文档来指定订购。我尝试了多次,发现PropertySource
后面提到的内容将覆盖前面提到的值PropertySource
。但是,如何确定?