Hibernate version: 3.2.1
Name and version of the database you are using: MSSQL server 2005
Hello All,
I have a simple entity called StaticStringDatasource. In this entity I have a list of string values which I want to save to a database. I used the collections annotation to do it.
Code:
@Entity
@Table(name = "Datasources_StaticString")
public class StaticStringDatasource extends Datasource {
/**
* List of values associated with the StaticStringDatasource.
*/
@CollectionOfElements
@JoinTable(name = "Datasources_StaticString_Values")
@Size(min = 1)
@Column(nullable = false)
private List<String> dataValues;
//getters and setters...
}
What I am trying to achieve is that when ever the static string datasource is saved the list of string values associated with it should also get saved.
If the supplied list is null and exception must be thrown. Now I think the annotation @Column should attain this, but it doesn't seem to be doing it.
If I supply a null list of string values it still works and no error is thrown. Please help I don't know what I am doing wrong.