How would you map the following class in hibernate:
private class Book {
private int id;
private String title;
private String[] chapterTitles;
//Constructor, Getters and Setters
}
I have mapped Collections and primitive arrays in Hibernate, but how do I do it with a String[]? My hibernate tools stops with a ‘NullPointerException’ thereby I am unable to generate the mappings. And I have googled but couldn’t find any.
I have no clue how to do it with Annotations and personally, I don’t think it’s good idea and you should use
List<String>however you can do it using xml mapping.You should use
<array>