users@glassfish.java.net

Re: A Non-ready-only Mapping

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Wed, 13 Feb 2008 18:46:57 -0800

glassfish_at_javadesktop.org wrote:
> Okay let me try to explain what I am doing. I have several tables created in SQL Server 2005. I have attempted to map the tables and columns correctly. I am running my JPA Annotations through Sun Server Verifier utility. I am deploying the application on Glassfish. When I attempt to run the application I and getting this top link error
>
> Exception Description: A non-read-only mapping must be defined for the sequence number field.
> Descriptor: RelationalDescriptor(com.dot.pkg.ejb.bean.entity.Address --> [DatabaseTable(databasename.dbo.address)])
>
> Here is how I have the Primary key defined:
>
>
> @Id
> @GeneratedValue(strategy=GenerationType.IDENTITY)
> @Column(name="addr_id", unique=true, nullable=false, insertable=false, updatable=false, precision=18, scale=0)
>
Try removing insertable=false, updatable=false above.
When you specify @GeneratedValue(strategy=GenerationType.IDENTITY),
toplink will never attempt to insert values into this column
> public Long getAddrId() {
> return this.addrId;
> }
>
> I and using the SQL Server2005 capability to generate the sequence number.
>
>
> Additionally, I am creating several objects in the servlet. These object represent the domain model.
>
> Can someone shed some light on this error?
>
> Russ
> [Message sent by forum member 'russ205' (russ205)]
>
> http://forums.java.net/jive/thread.jspa?messageID=258856
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>