[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| 
Re: [eclipselink-users] updatable=false ignored
 | 
Hello Antonio,
The bug linked describes the issue a bit better than I had in my email.  
The problem is that the insertable tag controls whether the mapping is 
writable or read-only, not the updatable.  You will need to either use 
both or none until the bug is fixed - it is currently still open.
Best Regards,
Chris
Antonio Goncalves wrote:
Hi,
I've updated my code to use Derby 10.5.3.0 and EclipseLink 2.0, but I 
still have the pb. I don't have both both insertable=false and 
updatable=false but only updatable=false. Any idea ?
Thanks,
Antonio
2009/7/13 <christopher.delahunt@xxxxxxxxxx 
<mailto:christopher.delahunt@xxxxxxxxxx>>
    Hello,
     
    EclipseLink only allows mappings to be writable or read-only. 
    Mappings marked as both insertable=false and updatable=false will
    be set as read-only.
    Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=243301 is
    related, please feel free to vote for it.
     
    Best Regards,
    Chris
    ----- Original Message -----
    From: "Antonio Mailing" <antonio.mailing@xxxxxxxxx
    <mailto:antonio.mailing@xxxxxxxxx>>
    To: "Eclipselink-Users" <eclipselink-users@xxxxxxxxxxx
    <mailto:eclipselink-users@xxxxxxxxxxx>>
    Sent: Saturday, July 11, 2009 6:01:51 AM GMT -05:00 US/Canada Eastern
    Subject: [eclipselink-users] updatable=false ignored
    Hi,
    I'm using EclipseLink 2.0M4 with Derby 10.5.1.1 and it looks like
    updatable=false is ignored. I have the following Entity with a
    title attribute set to updatable=false :
    @Entity
    public class BookCustomized {
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private Long id;
        @Column(name = "book_title", nullable = false, *updatable =
    false*)
        private String title;
        private Float price;
        private String description;
        private String isbn;
        @Column(name = "nb_of_page", nullable = false)
        private Integer nbOfPage;
        private Boolean illustrations;
    ...
    }
    But I can update the attribute. Here is the test case. Any idea ? 
    Thanks
    Antonio
     @Test
        public void titleShouldNotBeUpdatable() throws Exception {
            BookCustomized book = new BookCustomized("The Hitchhiker's
    Guide to the Galaxy", 12.5F, "The Hitchhiker's Guide to the Galaxy
    is a science fiction comedy series created by Douglas Adams.",
    "1-84023-742-2", 354, false);
            tx.begin();
            em.persist(book);
            tx.commit();
            assertNotNull("ID should not be null", book.getId());
            assertEquals("Title should be The Hitchhiker's Guide to
    the Galaxy", "The Hitchhiker's Guide to the Galaxy", book.getTitle());
            tx.begin();
            book = em.find(BookCustomized.class, book.getId());
            assertEquals("Title should be The Hitchhiker's Guide to
    the Galaxy", "The Hitchhiker's Guide to the Galaxy", book.getTitle());
            *book.setTitle("H2G2");*
            assertEquals("Title should be H2G2", "H2G2", book.getTitle());
            tx.commit();
            tx.begin();
            book = em.find(BookCustomized.class, book.getId());
            assertEquals("Title should be The Hitchhiker's Guide to
    the Galaxy", "The Hitchhiker's Guide to the Galaxy", book.getTitle());
            tx.commit();
        }
    _______________________________________________
    eclipselink-users mailing list
    eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
    https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
--
Antonio Goncalves (antonio.goncalves@xxxxxxxxx 
<mailto:antonio.goncalves@xxxxxxxxx>)
Software architect
Web site : www.antoniogoncalves.org <http://www.antoniogoncalves.org>
Blog: agoncal.wordpress.com <http://agoncal.wordpress.com>
Feed: feeds2.feedburner.com/AntonioGoncalves 
<http://feeds2.feedburner.com/AntonioGoncalves>
Paris JUG leader : www.parisjug.org <http://www.parisjug.org>
LinkedIn: www.linkedin.com/in/agoncal <http://www.linkedin.com/in/agoncal>
------------------------------------------------------------------------
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users