[Building Sakai] Auto generated primary key issue while saving object for mysql

Gopal Patil patil.gopal.a at gmail.com
Mon May 18 04:31:34 PDT 2009


Hello All,
 I am using sakai app bulder to develop new application in sakai.

  I could not insert new object of any object in to mysql databse.
 If i override save method in dao and daoImpl then it gives me null primary
key exception, even though i kept primary key as auto increament in databse
with size integer(20).

I tried native,sequence,identity classes for id generator in hbm.

If i use inherited save method  then also it gives me "You have an error in
your SQL syntax" exception.

this is my subject.hbm.xml
----------------------------------------------------------------------------
<hibernate-mapping package="org.sakaiproject.subject.dao.hbm">
 <class
name="Subject"
table="eduoaks_subject"
 >
<meta attribute="sync-DAO">false</meta>
<id
 name="id"
type="integer"
column="ID"
 >
<generator class="identity"/>
                     (i tried
                     <generator class="native">
                           <param name="sequence">Subject_ID_SEQ</param>
            </generator>
and <generator class="sequence"/>

)
</id>

<property
 name="code"
column="code"
type="string"
 not-null="false"
length="50"
/>
 <property
name="desc"
column="desc"
 type="string"
not-null="false"
length="255"
 />
<property
name="lecturers"
 column="lecturers"
type="string"
not-null="false"
 length="255"
/>
<property
 name="fees"
column="fees"
type="string"
 not-null="false"
length="10"
/>


</class>
</hibernate-mapping>
-----------------------------------------------------------------------------------------------------------------------



i am not getting what is problem????

i got fedup from this!!!!!!!!!!!

Please guide me.

Regards,
Gopal




-- 
Gopal



-- 
Gopal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090518/9cb7c76a/attachment.html 


More information about the sakai-dev mailing list