UniTime / unitime

Comprehensive University Timetabling System
http://www.unitime.org
Apache License 2.0
283 stars 163 forks source link

why I get this after load data #87

Closed Abdulaziz-KTA closed 3 years ago

Abdulaziz-KTA commented 3 years ago

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

tomas-muller commented 3 years ago

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=?
Abdulaziz-KTA commented 3 years ago

image

Is it correct write here???

tomas-muller commented 3 years ago

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%
Abdulaziz-KTA commented 3 years ago

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 
tomas-muller commented 3 years ago

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).

Abdulaziz-KTA commented 3 years ago

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

tomas-muller commented 3 years ago

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
  2. On the target system (windows) -- open up a MySQL shell

    mysql -uroot -p
  3. 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;


4. 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;

Abdulaziz-KTA commented 3 years ago

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

tomas-muller commented 3 years ago

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.

Abdulaziz-KTA commented 3 years ago

Yes, it's work and thank you.

Abdulaziz-KTA commented 3 years ago

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

tomas-muller commented 3 years ago

From the documentation of the Data Exchange page:

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.

tomas-muller commented 3 years ago

Is there any error in the Tomcat log? Most likely, you would see a violation of either uk_room database constraint (room with the same room number already exists in the bulding, but it does not have a matching external id), or uk_building database constraint (a building with the matching abbreviation already exists, but it does not have a matching external id).

On Thu, Jun 24, 2021 at 10:30 AM Abdulaziz Alharbi @.***> wrote:

I insert xml file about 2300 building and when update data I get this [image: image] https://user-images.githubusercontent.com/46826627/123229454-fac56200-d4de-11eb-936e-18d7e07457ee.png

and not show in database [image: image] https://user-images.githubusercontent.com/46826627/123229960-758e7d00-d4df-11eb-9642-73da99db85b1.png the last session is 6356992

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/UniTime/unitime/issues/87#issuecomment-867447211, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRDTUS6DICKI5UASKLCU5LTULULBANCNFSM454DVZKQ .

Abdulaziz-KTA commented 3 years ago

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