Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] updatable=false ignored

Done. I've voted for it.

Thanks,
Antonio

2009/7/13 <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>
To: "Eclipselink-Users" <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
https://dev.eclipse.org/mailman/listinfo/eclipselink-users




--
--
Antonio Goncalves (antonio.goncalves@xxxxxxxxx)
Software architect

Web site : www.antoniogoncalves.org
Blog: agoncal.wordpress.com
Feed: feeds2.feedburner.com/AntonioGoncalves
Paris JUG leader : www.parisjug.org
LinkedIn: www.linkedin.com/in/agoncal

Back to the top