|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
@BasicCollection non storing Integer typeMy code: @BasicCollection(valueColumn = @Column(name = "ALARM")) @CollectionTable(name = "SETTINGS_ALARMS", primaryKeyJoinColumns = {@PrimaryKeyJoinColumn(name = "SETTINGS_ID", referencedColumnName = "ID")}) private Set<Integer> alarms = new HashSet<Integer>(); public Set<Integer> getAlarms() { return Collections.unmodifiableSet(alarms); } public void addAlarm(int alarm) { alarms.add(alarm); } However the values of alarms are stored as strings. Has anyone experienced this? Thank you gaby |
|
|
Re: @BasicCollection non storing Integer typeI assume you mean the default table creation is creating a VARCHAR column, instead of NUMBER?
You can configure this by setting the columnDefinition of the @Column, although it seems like it should work from the code. Or are you trying to store it as a VARCHAR in the database and Integer is Java? If so then you can use a Converter.
James Sutherland EclipseLink, TopLink Wiki: EclipseLink, TopLink Forums: TopLink, EclipseLink Book: Java Persistence |
|
|
Re: @BasicCollection non storing Integer typeLooks like a bug. Please enter one.
In the mean time as a work around, try setting a TypeConverter on your mapping. That is, @BasicCollection(valueColumn = @Column(name = "ALARM")) @CollectionTable(name = "SETTINGS_ALARMS", primaryKeyJoinColumns ={@PrimaryKeyJoinColumn(name = "SETTINGS_ID", referencedColumnName = "ID")}) @Convert(Integer2Integer) @TypeConverter( name="Integer2Integer", dataType=Integer.class, objectType=Integer.class ) Cheers, Guy ----- Original Message ----- From: "astarte" <g.turek@...> To: <eclipselink-users@...> Sent: Tuesday, September 30, 2008 10:35 PM Subject: [eclipselink-users] @BasicCollection non storing Integer type > > > My code: > > @BasicCollection(valueColumn = @Column(name = "ALARM")) > @CollectionTable(name = "SETTINGS_ALARMS", primaryKeyJoinColumns = > {@PrimaryKeyJoinColumn(name = "SETTINGS_ID", referencedColumnName = > "ID")}) > private Set<Integer> alarms = new HashSet<Integer>(); > > public Set<Integer> getAlarms() > { > return Collections.unmodifiableSet(alarms); > } > public void addAlarm(int alarm) > { > alarms.add(alarm); > } > > However the values of alarms are stored as strings. Has anyone experienced > this? > Thank you > gaby > -- > View this message in context: > http://www.nabble.com/%40BasicCollection-non-storing-Integer-type-tp19753488p19753488.html > Sent from the EclipseLink - Users mailing list archive at Nabble.com. > > _______________________________________________ > eclipselink-users mailing list > eclipselink-users@... > https://dev.eclipse.org/mailman/listinfo/eclipselink-users > _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: @BasicCollection non storing Integer typeThank you! Using column definition worked. is this a bug then? If it is I'll report it
gaby
|
| Free embeddable forum powered by Nabble | Forum Help |