Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> Java Persistence API

Pages: 1
Cedric Hurst
Unregistered




Errata: Use Generics in @ManyToMany Collections
      #87011 - 01/24/08 11:19 AM

Great article series! Wish this was around when I was first learning JPA (would have saved a lot of money on books). If I might make one suggestion, though. In listings 10 and 12, you have your productList and orderList collections specified as List. This is likely to make the following code in Listing 14 fail, for example:

for(Order allOrders: customer.getOrders())

The runtime is expecting a list of Object, not Order, so you'll need to do an explicit typecast to List<Order>. In your sample code, it looks like you are, in fact, using Generics, but you might want to update the article content to avoid confusion.


Post Extras: Print Post   Remind Me!   Notify Moderator  
AthenAdministrator
journeyman


Reged: 06/05/07
Posts: 79
Loc: San Francisco, CA
Re: Errata: Use Generics in @ManyToMany Collection [Re: Cedric Hurst]
      #87035 - 01/24/08 03:42 PM

Thanks for calling our attention to these errors. The generics were missing in Listings 10 and 12 - fixed now, and should be fine in the code download!

--------------------
Athen O'Shea
Editor, JavaWorld.com


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 3784

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5