UniTime/unitime

why I get this after load data

Abdulaziz-KTA opened this issue · 14 comments

the sql file take it from ubuntu 16.04.1 server to windows server

Could you please send me the whole stack trace of the error?

The LastLikeStudentCourseDemands.loadSubject(..) call does the following HQL:

select distinct d.courseNbr, d.coursePermId, s, d.priority
from LastLikeCourseDemand d inner join d.student s left join fetch s.areaClasfMajors where
d.subjectArea.uniqueId = :subjectAreaId

which is translated to the following SQL by Hibernate (UniTime 4.5.164):

select distinct
  lastlikeco0_.course_nbr as col_0_0_,
  lastlikeco0_.course_perm_id as col_1_0_,
  student1_.uniqueid as col_2_0_, 
  lastlikeco0_.priority as col_3_0_,
  areaclasfm2_.uniqueid as uniqueid1_191_2_,
  student1_.uniqueid as uniqueid1_188_0_,
  areaclasfm2_.uniqueid as uniqueid1_191_1_,
  student1_.external_uid as external2_188_0_,
  student1_.first_name as first_na3_188_0_,
  student1_.middle_name as middle_n4_188_0_,
  student1_.last_name as last_nam5_188_0_,
  student1_.email as email6_188_0_,
  student1_.free_time_cat as free_tim7_188_0_,
  student1_.schedule_preference as schedule8_188_0_,
  student1_.max_credit as max_cred9_188_0_,
  student1_.min_credit as min_cre10_188_0_,
  student1_.req_credit as req_cre11_188_0_,
  student1_.req_status as req_sta12_188_0_,
  student1_.req_extid as req_ext13_188_0_,
  student1_.req_ts as req_ts14_188_0_,
  student1_.pin as pin15_188_0_,
  student1_.pin_released as pin_rel16_188_0_,
  student1_.session_id as session17_188_0_,
  student1_.sect_status as sect_st18_188_0_,
  student1_.schedule_emailed as schedul19_188_0_,
  areaclasfm2_.student_id as student_2_191_1_,
  areaclasfm2_.acad_area_id as acad_are3_191_1_,
  areaclasfm2_.acad_clasf_id as acad_cla4_191_1_,
  areaclasfm2_.major_id as major_id5_191_1_,
  areaclasfm2_.concentration_id as concentr6_191_1_,
  areaclasfm2_.degree_id as degree_i7_191_1_,
  areaclasfm2_.weight as weight8_191_1_,
  areaclasfm2_.student_id as student_2_188_0__,
  areaclasfm2_.uniqueid as uniqueid1_191_0__
from
  timetable.lastlike_course_demand lastlikeco0_
  inner join timetable.student student1_ on lastlikeco0_.student_id=student1_.uniqueid
  left outer join timetable.student_area_clasf_major areaclasfm2_ on student1_.uniqueid=areaclasfm2_.student_id
where
  lastlikeco0_.subject_area_id=?

image

Is it correct write here???

This is because the named parameter :subjectAreaId needs to be replaced by a unique id of a subject area. The Test HQL page cannot use named parameters as it does not know how to set them. The only exception is %SESSION% which gets replaced with the unique id of the current academic session.

Like, for instance:

Screen Shot 2021-06-02 at 08 15 47

Or you can list all last-like course demands (for the current academic session) using the following HQL:

select distinct d.courseNbr, d.coursePermId, s, d.priority
from LastLikeCourseDemand d inner join d.student s left join fetch s.areaClasfMajors where
d.subjectArea.session = %SESSION%

this is the result

    select q from StudentSectioningQueue q where q.sessionId = :sessionId
       select
           studentsec0_.uniqueid as uniqueid1_169_,
           studentsec0_.session_id as session_2_169_,
           studentsec0_.time_stamp as time_sta3_169_,
           studentsec0_.type as type4_169_,
           studentsec0_.message as message5_169_ 
       from
           timetable.sectioning_queue studentsec0_ 
       where
    studentsec0_.session_id=? 

/* select
    distinct d.courseNbr,
    d.coursePermId,
    s,
    d.priority 



   from
       LastLikeCourseDemand d 
   inner join
       d.student s 
   left join
       fetch s.areaClasfMajors 
   where



d.subjectArea.uniqueId = (
    5046272
) */ select
    distinct lastlikeco0_.course_nbr as col_0_0_,
    lastlikeco0_.course_perm_id as col_1_0_,
    student1_.uniqueid as col_2_0_,
    lastlikeco0_.priority as col_3_0_,
    areaclasfm2_.uniqueid as uniqueid1_191_2_,
    student1_.uniqueid as uniqueid1_188_0_,
    areaclasfm2_.uniqueid as uniqueid1_191_1_,
    student1_.external_uid as external2_188_0_,
    student1_.first_name as first_na3_188_0_,
    student1_.middle_name as middle_n4_188_0_,
    student1_.last_name as last_nam5_188_0_,
    student1_.email as email6_188_0_,
    student1_.free_time_cat as free_tim7_188_0_,
    student1_.schedule_preference as schedule8_188_0_,
    student1_.max_credit as max_cred9_188_0_,
    student1_.min_credit as min_cre10_188_0_,
    student1_.req_credit as req_cre11_188_0_,
    student1_.req_status as req_sta12_188_0_,
    student1_.req_extid as req_ext13_188_0_,
    student1_.req_ts as req_ts14_188_0_,
    student1_.pin as pin15_188_0_,
    student1_.pin_released as pin_rel16_188_0_,
    student1_.session_id as session17_188_0_,
    student1_.sect_status as sect_st18_188_0_,
    student1_.schedule_emailed as schedul19_188_0_,
    areaclasfm2_.student_id as student_2_191_1_,
    areaclasfm2_.acad_area_id as acad_are3_191_1_,
    areaclasfm2_.acad_clasf_id as acad_cla4_191_1_,
    areaclasfm2_.major_id as major_id5_191_1_,
    areaclasfm2_.concentration_id as concentr6_191_1_,
    areaclasfm2_.degree_id as degree_i7_191_1_,
    areaclasfm2_.weight as weight8_191_1_,
    areaclasfm2_.student_id as student_2_188_0__,
    areaclasfm2_.uniqueid as uniqueid1_191_0__ 
from
    timetable.lastlike_course_demand lastlikeco0_ 
inner join
    timetable.student student1_ 
        on lastlikeco0_.student_id=student1_.uniqueid 
left outer join
    timetable.student_area_clasf_major areaclasfm2_ 
        on student1_.uniqueid=areaclasfm2_.student_id 
where
    lastlikeco0_.subject_area_id=5046272 

The generated SQL query is the same as what I have put in earlier. And it looks ok to me.

Did you get any error? Also, could you please send me the whole stack trace of the original error (your screenshot is cut in the middle of the error's stack trace) -- usually, there is a caused by section which has more details.

My guess is that your database did not get updated correctly with one of the latest updates (like the degree_id field that was added to student_area_clasf_major in update 239) and the query is failing because of that. But I would need to see the full tomcat log for that -- or you can check if there are any errors when UniTime is being deployed (e.g., during the Tomcat restart).

I make pack up database from google cloud ubuntu server and resort data into windows server
when I do this only in ubuntu not get any problem.

image

I guess there was some problem with copying your database from ubuntu to windows then. If you have a mysqldump from ubuntu, you need to delete the timetable database on windows first and use the dump to create all tables (instead of trying to populate the existing tables, especially if the UniTime on the target system is of a different version or if the database has not been updated -- it was created by the timetable.sql and blank-data.sql, but the UniTime instance was not started yet).

  1. On the source system (ubuntu) -- make a dump of your source database:
mysqldump -utimetable -punitime timetable >backup.sql
  1. On the target system (windows) -- open up a MySQL shell
mysql -uroot -p
  1. From the MySQL shell, (re-)create the timetable database and populate it with the dumped data
drop database if exists timetable;
create database timetable character set utf8;
use timetable;

source backup.sql;
  1. Also from the MySQL shell, (re-)create the timetable user and give it permissions to the timetable database:
drop user if exists timetable@localhost;
create user timetable@localhost identified by 'unitime';
grant all on timetable.* to timetable@localhost;
flush privileges;

thank you, it is work may be when I backup database not get all data.

Ok, so it is working now, right?

I think the issue is that when you just copy over the data, you need to make absolutely sure that the source and the target database are of the very same version. So, for example, if the student_area_clasf_major table is missing the degree_id column in the target database (because it has been just created without running the same version of UniTime -- and by the same version I mean the very same build -- not like 4.5.154 on one and 4.5.164 on the other), it does not get copied over which could create all sorts of issues.

Yes, it's work and thank you.

in Data Exchange I import data Building, Room and staffMember not import only department is success, How to solve that ?

From the documentation of the Data Exchange page:

  • Buildings and rooms are imported as external buildings and rooms, you need to use Update Data operation on Buildings page (menu Administration > Academic Sessions > Buildings) for the buildings and rooms to show up in the application. Global room features need to be created before this update, and their abbreviation must match the roomFeature.feature attribute.

  • Staff is imported into the staff table, to pull in the instructors use the Manage Instructor List operation on the Instructors page (menu Courses > Input Data > Instructors).

The reason for this is that we have two sets of rooms, the list of external rooms (which are imported from the XML, and expected to be changed quite often), and the list of rooms that is actually being used for timetabling -- that should not change uncontrollably especially during the time a course timetable is being produced.

Similarly, the staff table may contain all the personnel on campus (which can get periodically updated), and it is up to the departmental schedule manager to pull in the people he/she needs for timetabling.

I solve that to create new number by python on our databases has duplicate data