org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not execute query; SQL [select this_.id as id3_4_, this_.questionText as question2_3_4_, this_.questionType as question3_3_4_, this_.roll_id as roll4_3_4_, this_.subject_id as subject5_3_4_, this_.syllabus_id as syllabus6_3_4_, roll2_.id as id4_0_, roll2_.contact as contact4_0_, roll2_.rollno as rollno4_0_, roll2_.studentName as studentN4_4_0_, subject3_.id as id0_1_, subject3_.course as course0_1_, subject3_.sem as sem0_1_, subject3_.subjectName as subjectN4_0_1_, subject3_.syllabuspath as syllabus5_0_1_, syllabus4_.id as id6_2_, syllabus4_.chapterName as chapterN2_6_2_, syllabus4_.subject_id as subject3_6_2_, subject5_.id as id0_3_, subject5_.course as course0_3_, subject5_.sem as sem0_3_, subject5_.subjectName as subjectN4_0_3_, subject5_.syllabuspath as syllabus5_0_3_ from question this_ left outer join roll roll2_ on this_.roll_id=roll2_.id left outer join subject subject3_ on this_.subject_id=subject3_.id left outer join syllabus syllabus4_ on this_.syllabus_id=syllabus4_.id left outer join subject subject5_ on syllabus4_.subject_id=subject5_.id where subject_id = 1 and questionType='University' and 1=1 order by rand()]; Column 'subject_id' in where clause is ambiguous; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'subject_id' in where clause is ambiguous] with root cause com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'subject_id' in where clause is ambiguous

Stack Overflow | Patty31 | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    SQL Error: 1054, SQLState: 42S22

    Stack Overflow | 4 years ago | Patty31
    org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not execute query; SQL [select this_.id as id3_4_, this_.questionText as question2_3_4_, this_.questionType as question3_3_4_, this_.roll_id as roll4_3_4_, this_.subject_id as subject5_3_4_, this_.syllabus_id as syllabus6_3_4_, roll2_.id as id4_0_, roll2_.contact as contact4_0_, roll2_.rollno as rollno4_0_, roll2_.studentName as studentN4_4_0_, subject3_.id as id0_1_, subject3_.course as course0_1_, subject3_.sem as sem0_1_, subject3_.subjectName as subjectN4_0_1_, subject3_.syllabuspath as syllabus5_0_1_, syllabus4_.id as id6_2_, syllabus4_.chapterName as chapterN2_6_2_, syllabus4_.subject_id as subject3_6_2_, subject5_.id as id0_3_, subject5_.course as course0_3_, subject5_.sem as sem0_3_, subject5_.subjectName as subjectN4_0_3_, subject5_.syllabuspath as syllabus5_0_3_ from question this_ left outer join roll roll2_ on this_.roll_id=roll2_.id left outer join subject subject3_ on this_.subject_id=subject3_.id left outer join syllabus syllabus4_ on this_.syllabus_id=syllabus4_.id left outer join subject subject5_ on syllabus4_.subject_id=subject5_.id where subject_id = 1 and questionType='University' and 1=1 order by rand()]; Column 'subject_id' in where clause is ambiguous; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'subject_id' in where clause is ambiguous] with root cause com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'subject_id' in where clause is ambiguous
  2. 0

    How to get first name and last name from contacts?

    Stack Overflow | 10 months ago | user6265109
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.siddhi.meavita/com.example.siddhi.meavita.Activities.ContactList}: android.database.sqlite.SQLiteException: near ")": syntax error (code 1): , while compiling: SELECT sort_key, photo_uri, status_updates.status_label AS status_label, status_updates.status_ts AS status_ts, status_updates.status_res_package AS status_res_package, display_name, data_usage_stat.last_time_used AS last_time_used, mimetype, phonebook_label_alt, data6, version, photo_id, data3, custom_ringtone, times_contacted, account_type_and_data_set, dirty, data7, data15, raw_contact_is_user_profile, data_set, phonebook_label, data10, res_package, account_type, data11, display_name_alt, lookup, phonetic_name, last_time_contacted, contact_last_updated_timestamp, data13, in_visible_group, presence.chat_capability AS chat_capability, data9, carrier_presence, data_sync1, sort_key_alt, agg_presence.mode AS contact_presence, data_version, phonetic_name_style, name_raw_contact_id, raw_contact_id, send_to_voicemail, data4, data12, contacts_status_updates.status AS contact_status, contacts_status_updates.status_label AS contact_status_label, pinned, status_updates.status_icon AS status_icon, status_updates.status AS status, data1, phonebook_bucket, data_sync2, contacts_status_updates.status_res_package AS contact_status_res_package, in_default_directory, _id, hash_id, is_super_primary, data5, contact_id, data8, is_primary, data_sync4, has_phone_number, display_name_source, photo_file_id, data_sync3, backup_id, data14, contacts_status_updates.status_ts AS contact_status_ts, phonebook_bucket_alt, presence.mode AS mode, data2, group_sourceid, starred, photo_thumb_uri, data_usage_stat.times_used AS times_used, contacts_status_updates.status_icon AS contact_status_icon, agg_presence.chat_capability AS contact_chat_capability, account_name, sourceid FROM view_data data LEFT OUTER JOIN agg_presence ON (contact_id = agg_presence.presence_contact_id) LEFT OUTER JOIN status_updates contacts_status_updates ON (status_update_id=contacts_status_updates.status_update_data_id) LEFT OUTER JOIN presence ON (presence_data_id=data._id) LEFT OUTER JOIN status_updates ON (status_updates.status_update_data_id=data._id) LEFT OUTER JOIN (SELECT data_usage_stat.data_id as STAT_DATA_ID, SUM(data_usage_stat.times_used) as times_used, MAX(data_usage_stat.last_time_used) as last_time_used FROM data_usage_stat GROUP BY data_usage_stat.data_id) as data_usage_stat ON (STAT_DATA_ID=data._id) WHERE (1) ORDER BY data2) ASC
  3. 0

    Frank Altpeter (frank42) - Google+

    google.com | 1 year ago
    android.database.sqlite.SQLiteException: no such column: carrier_presence (code 1): , while compiling: SELECT sort_key, photo_uri, status_updates.status_label AS status_label, status_updates.status_ts AS status_ts, status_updates.status_res_package AS status_res_package, display_name, data_usage_stat.last_time_used AS last_time_used, mimetype, phonebook_label_alt, data6, version, photo_id, data3, custom_ringtone, times_contacted, account_type_and_data_set, dirty, data7, data15, raw_contact_is_user_profile, data_set, phonebook_label, data10, res_package, account_type, data11, display_name_alt, lookup, phonetic_name, last_time_contacted, contact_last_updated_timestamp, data13, in_visible_group, presence.chat_capability AS chat_capability, data9, carrier_presence, data_sync1, sort_key_alt, agg_presence.mode AS contact_presence, data_version, phonetic_name_style, name_raw_contact_id, raw_contact_id, send_to_voicemail, data4, data12, contacts_status_updates.status AS contact_status, contacts_status_updates.status_label AS contact_status_label, pinned, status_updates.status_icon AS status_icon, status_updates.status AS status, data1, phonebook_bucket, data_sync2, contacts_status_updates.status_res_package AS contact_status_res_package, in_default_directory, _id, hash_id, is_super_primary, data5, contact_id, data8, is_primary, data_sync4, has_phone_number, display_name_source, photo_file_id, data_sync3, backup_id, data14, contacts_status_updates.status_ts AS contact_status_ts, phonebook_bucket_alt, presence.mode AS mode, data2, group_sourceid, starred, photo_thumb_uri, data_usage_stat.times_used AS times_used, contacts_status_updates.status_icon AS contact_status_icon, agg_presence.chat_capability AS contact_chat_capability, account_name, sourceid FROM view_data data LEFT OUTER JOIN agg_presence ON (contact_id = agg_presence.presence_contact_id) LEFT OUTER JOIN status_updates contacts_status_updates ON (status_update_id=contacts_status_updates.status_update_data_id) LEFT OUTER JOIN presence ON (presence_data_id=data._id) LEFT OUTER JOIN status_updates ON (status_updates.status_update_data_id=data._id) LEFT OUTER JOIN (SELECT data_usage_stat.data_id as STAT_DATA_ID, SUM(data_usage_stat.times_used) as times_used, MAX(data_usage_stat.last_time_used) as last_time_used FROM data_usage_stat GROUP BY data_usage_stat.data_id) as data_usage_stat ON (STAT_DATA_ID=data._id) WHERE (1 AND mimetype_id=5) AND ((contact_id = ?))
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Remote procedure call error

    GitHub | 3 years ago | milci199
    javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: General error: "java.lang.ArrayIndexOutOfBoundsException: 2048"; SQL statement:|select devices0_.users_id as users1_4_3_, devices0_.devices_id as devices2_5_3_, device1_.id as id1_0_, device1_.latestPosition_id as latestPo4_1_0_, device1_.name as name1_0_, device1_.uniqueId as uniqueId1_0_, position2_.id as id2_1_, position2_.address as address2_1_, position2_.altitude as altitude2_1_, position2_.course as course2_1_, position2_.device_id as device12_2_1_, position2_.latitude as latitude2_1_, position2_.longitude as longitude2_1_, position2_.other as other2_1_, position2_.power as power2_1_, position2_.speed as speed2_1_, position2_.time as time2_1_, position2_.valid as valid2_1_, device3_.id as id1_2_, device3_.latestPosition_id as latestPo4_1_2_, device3_.name as name1_2_, device3_.uniqueId as uniqueId1_2_ from users_devices devices0_ inner join devices device1_ on devices0_.devices_id=device1_.id left outer join positions position2_ on device1_.latestPosition_id=position2_.id left outer join devices device3_ on position2_.device_id=device3_.id where devices0_.users_id=? [50000-180]

  1. Axelo 1 times, last 4 weeks ago
  2. Omya 1 times, last 3 months ago
1 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.springframework.dao.DataIntegrityViolationException

    Hibernate operation: could not execute query; SQL [select this_.id as id3_4_, this_.questionText as question2_3_4_, this_.questionType as question3_3_4_, this_.roll_id as roll4_3_4_, this_.subject_id as subject5_3_4_, this_.syllabus_id as syllabus6_3_4_, roll2_.id as id4_0_, roll2_.contact as contact4_0_, roll2_.rollno as rollno4_0_, roll2_.studentName as studentN4_4_0_, subject3_.id as id0_1_, subject3_.course as course0_1_, subject3_.sem as sem0_1_, subject3_.subjectName as subjectN4_0_1_, subject3_.syllabuspath as syllabus5_0_1_, syllabus4_.id as id6_2_, syllabus4_.chapterName as chapterN2_6_2_, syllabus4_.subject_id as subject3_6_2_, subject5_.id as id0_3_, subject5_.course as course0_3_, subject5_.sem as sem0_3_, subject5_.subjectName as subjectN4_0_3_, subject5_.syllabuspath as syllabus5_0_3_ from question this_ left outer join roll roll2_ on this_.roll_id=roll2_.id left outer join subject subject3_ on this_.subject_id=subject3_.id left outer join syllabus syllabus4_ on this_.syllabus_id=syllabus4_.id left outer join subject subject5_ on syllabus4_.subject_id=subject5_.id where subject_id = 1 and questionType='University' and 1=1 order by rand()]; Column 'subject_id' in where clause is ambiguous; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'subject_id' in where clause is ambiguous] with root cause com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'subject_id' in where clause is ambiguous

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0()
  2. Java RT
    Constructor.newInstance
    1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    4. java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    4 frames
  3. MySQL jdbc
    PreparedStatement.executeQuery
    1. com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
    2. com.mysql.jdbc.Util.getInstance(Util.java:384)
    3. com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1041)
    4. com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566)
    5. com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)
    6. com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
    7. com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
    8. com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
    9. com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)
    10. com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2275)
    10 frames
  4. Commons DBCP
    DelegatingPreparedStatement.executeQuery
    1. org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
    1 frame
  5. Hibernate
    CriteriaLoader.list
    1. org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
    2. org.hibernate.loader.Loader.getResultSet(Loader.java:1812)
    3. org.hibernate.loader.Loader.doQuery(Loader.java:697)
    4. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
    5. org.hibernate.loader.Loader.doList(Loader.java:2232)
    6. org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
    7. org.hibernate.loader.Loader.list(Loader.java:2124)
    8. org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
    8 frames
  6. Hibernate
    CriteriaImpl.list
    1. org.hibernate.impl.SessionImpl.list(SessionImpl.java:1597)
    2. org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
    2 frames
  7. Hibernate
    HibernateTemplate.findByCriteria
    1. org.springframework.orm.hibernate3.HibernateTemplate$35.doInHibernate(HibernateTemplate.java:966)
    2. org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:366)
    3. org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(HibernateTemplate.java:956)
    3 frames
  8. org.Trainning.service
    QuestionServiceImpl.getAnyQuestion
    1. org.Trainning.service.question.QuestionServiceImpl.getAnyQuestion(QuestionServiceImpl.java:91)
    1 frame
  9. org.Trainning.controller
    ActivityController.getAnyQuestion
    1. org.Trainning.controller.activities.ActivityController.getAnyQuestion(ActivityController.java:749)
    1 frame
  10. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:601)
    4 frames
  11. Spring
    InvocableHandlerMethod.invokeForRequest
    1. org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
    2. org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
    2 frames
  12. Spring MVC
    FrameworkServlet.doGet
    1. org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
    2. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:647)
    3. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:603)
    4. org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
    5. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)
    6. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:859)
    7. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:883)
    8. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:781)
    8 frames
  13. JavaServlet
    HttpServlet.service
    1. javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    2. javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    2 frames
  14. Glassfish Core
    CoyoteAdapter.service
    1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    5. org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    6. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    7. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    8. org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
    9. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    10. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    10 frames
  15. Grizzly HTTP
    JIoEndpoint$SocketProcessor.run
    1. org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    2. org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
    3. org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
    3 frames
  16. Java RT
    Thread.run
    1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    3. java.lang.Thread.run(Thread.java:722)
    3 frames