I've tried @PersistentCollection with a recent 
openjpa-1.1.0-SNAPSHOT-r420667:570593 and it doesn't appear to work with 
Integers.


---- Declaration ----

   @PersistentCollection(fetch=FetchType.EAGER)
   @ContainerTable(name="ItemItemCategory", [EMAIL PROTECTED](name="itemId"))
   @Column(name="itemCategoryId")
   private HashSet<Integer> itemCategoryIds = new HashSet<Integer>();

---- Stack Trace ----
(The HashSet was empty, nothing was put in there yet.)

Caused by: <openjpa-1.1.0-SNAPSHOT-r420667:570593 nonfatal general error> 
org.apache.openjpa.persistence.PersistenceException: Incorrect integer value: 
'B,C-' for column 
'itemCategoryId' at row 1 {prepstmnt 31918258 INSERT INTO ItemItemCategory 
(itemId, itemCategoryId) VALUES (?, ?) [params=(int) 1, (InputStream) 
[EMAIL PROTECTED] [code=1366, state=HY000]
FailedObject: [EMAIL PROTECTED]
        at 
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:3869)
        at 
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:97)
        at 
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:67)
        at 
org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal(PreparedStatementManagerImpl.java:106)
        at 
org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush(PreparedStatementManagerImpl.java:71)
        at 
org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flushGraph(ConstraintUpdateManager.java:350)
        at 
org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:96)
        at 
org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:89)
        at 
org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:72)
        at 
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:514)
        at 
org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130)
        ... 38 more
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Incorrect integer 
value: 'B,C-' for column 'itemCategoryId' at row 1 {prepstmnt 31918258 INSERT 
INTO 
ItemItemCategory (itemId, itemCategoryId) VALUES (?, ?) [params=(int) 1, 
(InputStream) [EMAIL PROTECTED] [code=1366, state=HY000]
        at 
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
        at 
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800(LoggingConnectionDecorator.java:57)
        at 
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate(LoggingConnectionDecorator.java:858)
        at 
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:269)
        at 
org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeUpdate(JDBCStoreManager.java:1363)
        at 
org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal(PreparedStatementManagerImpl.java:95)
        ... 45 more




> Hi,
> 
> You should use the OpenJPA @PersistentCollection annotation.
> 
> Note that this only works in the trunk (1.1.0-SNAPSHOT) builds, as of
> maybe 3 or 4 weeks ago.
> 
> -Patrick
> 
> On Nov 14, 2007 7:43 AM, Nicolas Modrzyk <[EMAIL PROTECTED]> wrote:
> > Hello hello,
> >
> > Could someone confirm the proper way to persistent a collection/set of 
> > String:
> >
> > @OneToMany
> > private Collection<String> set;
> >
> > Whatever I am trying to use is resulting in the exception below, where
> > I am told to choose a different persistence strategy.
> >
> >     [junit] The type of field "...set" isn't supported by declared
> > persistence strategy "OneToMany".  Please choose a different strategy.
> >     [junit] <openjpa-1.0.0-r420667:568756 fatal user error>
> > org.apache.openjpa.persistence.ArgumentException: The type of field
> > "...set" isn't supported by declared persistence strategy "OneToMany".
> >  Please choose a different strategy.
> >     [junit]     at
> > org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseOneToMany(AnnotationPersistenceMetaDataParser.java:1283)
> >     [junit]     at
> > org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseMemberAnnotations(AnnotationPersistenceMetaDataParser.java:944)
> >     [junit]     at
> > org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseClassAnnotations(AnnotationPersistenceMetaDataParser.java:599)
> >     [junit]     at
> > org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parse(AnnotationPersistenceMetaDataParser.java:349)
> >
> > Thank you in advance !
> >
> > Niko,
> >
> 
> 
> 
> -- 
> Patrick Linskey
> 202 669 5907

-- 
                                                           Ted Leung
                                                           [EMAIL PROTECTED]

You know things are getting a little fishy when you're commenting out 
comments.

Reply via email to