spring - How to mapping a list of java.net.URL with JPA? -


i try:

@onetomany(cascade = cascadetype.all, fetch = fetchtype.eager) protected list<url> urllist; 

but error:

org.springframework.beans.factory.beancreationexception: error creating  bean name 'entitymanagerfactory' defined in servletcontext resource  [/web-inf/servlet-context.xml]: invocation of init method failed; nested  exception org.hibernate.annotationexception: use of @onetomany or  @manytomany targeting unmapped class:  my.package.mymodel.urllist[java.net.url] 

i saw this answers, can't mapping list of urls.

using elementcollection , collectiontable way map collection of non-entity elements.

@elementcollection @collectiontable(name="my_urls") collection<url> urllist; 

then depend on whether jpa provider supports persistence of element type (url) out of box. provider (datanucleus) does. can use attributeconverter if doesn't


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -