-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: VALUE TOO LARGE FOR COLUMN
PostPosted: Fri Oct 30, 2009 4:46 pm 
Newbie

Joined: Fri Oct 30, 2009 4:30 pm
Posts: 16
I have a CourseOffering object defined in my application. It has for primary key Semester, CourseNo, and Section which are strings.

I have another object called Faculty whose primary key is fac_id which is an integer.

Now I created an association between Faculty and CourseOffering and placed that association within CourseOffering.

@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name="TAUGHT_BY", joinColumns = {@JoinColumn(name = "SEMESTER", nullable = false, updatable = false),
@JoinColumn(name = "COURSE_NO", nullable = false, updatable = false),
@JoinColumn(name = "SECTION", nullable = false, updatable = false)
},
inverseJoinColumns = { @JoinColumn(name = "FAC_ID", nullable = false, updatable = false) }

)


The join table is TAUGHT_BY which has a primary key as (SEMESTER_ID, COURSE_NO, SECTION and FAC_ID).


public Set<Faculty> getFaculty(){
return this.faculties;
}

public void setFaculty(Set<Faculty> faculties){
this.faculties = faculties;
}

I have also created a TaughtBy entity object in my application.



ISSUE
-------


Now the issue is this, as I am saving my CourseOffering object. I set the CourseOffering.setFaculty and update the object.


The UPDATE QUERY FIRES and the resulting query is this:
update
KARYN.COURSE_OFFERING
set
COURSE_TITLE=?,
COURSE_TOTAL=?,
COURSE_TYPE=?,
DATE_ENTERED=?,
DATE_UPDATED=?,
DISPLAY_FAC_NAME=?,
ENTERED_BY=?,
EVALREQD=?,
MIDEVAL=?,
MINI_NO=?,
NO_RATERS=?,
ONLINEEVAL=?,
PROJCOURSE=?,
RATING=?,
SEM_ORDER=?,
UNITS=?,
UPDATED_BY=?
where
COURSE_NO=?
and SECTION=?
and SEMESTER=?


16:22:12,730 INFO [STDOUT] Hibernate:
delete
from
TAUGHT_BY
where
SEMESTER=?
and COURSE_NO=?
and SECTION=?


16:22:12,730 INFO [STDOUT] Hibernate:
insert
into
TAUGHT_BY
(SEMESTER, COURSE_NO, SECTION, FAC_ID)
values
(?, ?, ?, ?)


16:22:12,746 INFO [STDOUT] Hibernate:
insert
into
TAUGHT_BY
(SEMESTER, COURSE_NO, SECTION, FAC_ID)
values
(?, ?, ?, ?)


16:22:12,746 INFO [STDOUT] Hibernate:
insert
into
TAUGHT_BY
(SEMESTER, COURSE_NO, SECTION, FAC_ID)
values
(?, ?, ?, ?)


16:22:12,746 INFO [STDOUT] Hibernate:
insert
into
TAUGHT_BY
(SEMESTER, COURSE_NO, SECTION, FAC_ID)
values
(?, ?, ?, ?)


while it is inserting into TAUGHTBY, maybe my relationship mapping is wrong.

I get the following error.

SQL Error: 12899, SQLState: 72000
value too large for column "KARYN"."TAUGHT_BY"."SEMESTER" (actual: 6, maximum: 3).

I verified that the SEMESTER in all the tables is of size 3. So what is happening.

P.S: THERE is 1 UPDATE QUERY AND 4 INSERT QUERIES since I am inserting 4 faculty objects into the DB.
Please let me know the solution.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.