Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] @BasicCollection non storing Integer type

I 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.



astarte wrote:
> 
> 
> 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
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/%40BasicCollection-non-storing-Integer-type-tp19753488p19760690.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top