我最近升级到Helio SR2,包浏览器的排序顺序现在按名称排序,无论类型如何.有没有办法指定排序顺序?
在上面的示例中,文件和文件夹不按类型排序,然后按名称排序(如在Windows资源管理器中).
以前的版本是这样排序的 - 我只是不确定如何设置它.
我是JPA的新手,我正在尝试映射遗留数据库.文件单独正确加载但关系无法正常工作.任何帮助,将不胜感激.
Java的
@Entity
@IdClass(ParentKey.class)
public class Parent {
@Id
@Column(name="code")
private String code;
@Id
@Column(name="id")
private int id;
@OneToMany(mappedBy="parent")
private List<Child> children = new ArrayList<Child>();
}
public class ParentKey {
private String code;
private int id;
}
@Entity
@IdClass(ChildKey.class)
public class Child {
@Id
@JoinColumns({
@JoinColumn(name="code")
@JoinColumn(name="id")
})
private Parent parent;
@Id
@Column(name="index")
private int index;
}
public class ChildKey {
private String code;
private int id;
private int index;
}
Run Code Online (Sandbox Code Playgroud)
SQL
create table Parent(
code char(4) not null,
id …Run Code Online (Sandbox Code Playgroud) 我有一个用 Spring 3.0 编写的应用程序,它使用 Hibernate 连接到数据库。我有一个更新表单的控制器。每当提交表单时,我都希望显示的对象被更新,但是会创建一个具有新 ID 值的新对象。我查看了“petclinic”样本,我看不出它有什么不同。
POJO
public class Person
{
private int id;
@NotNull
private String name;
//getter/setter for id
//getter/setter for name
}
Run Code Online (Sandbox Code Playgroud)
控制器
public class PersonUpdateController
{
//injected
private PersonService personService;
@RequestMapping(value="/person/{personId}/form", method=RequestMethod.POST)
public String updateForm(ModelMap modelMap, @PathVariable personId)
{
Person person = personService.getById(personId);
modelMap.addAttribute(person);
return "person/update";
}
@RequestMapping(value="/person/{personId}", method=RequestMethod.POST)
public String update(ModelMap modelMap, @Valid Person person, BindingResult bindingResult)
{
if(bindingResult.hasErrors())
{
modelMap.addAttribute(person);
return "person/update";
}
personService.save(person);
return "redirect:person/" + person.getId() + "/success";
}
} …Run Code Online (Sandbox Code Playgroud)