Java.sql.sqlsyntaxerrorexception: неизвестный столбец «u1_0.userid» в списке поля »после обновления Springboot до 3JAVA

Программисты JAVA общаются здесь
Anonymous
Java.sql.sqlsyntaxerrorexception: неизвестный столбец «u1_0.userid» в списке поля »после обновления Springboot до 3

Сообщение Anonymous »

После весенней загрузки обновления загрузки до версии 3, получение ошибки, которая работала раньше, пытаясь сохранить add/update user -preferences Entity в MySQL db. И имя столбца и имя объекта тоже совпадают. Ошибка происходит только для вставки. Во время осмотра функции save () для добавления новой строки ошибка происходит для выбора запроса, как указано ниже < /p>

org.springframework.dao.invaliddataaccessresourceUsageExcept от пользователя u1_0, где u1_0.user_id =?] [Неизвестный столбец 'u1_0.userid' в «Полевом списке»] [n/a]; SQL [n /a]
at org.springframework.orm.jpa.vendor.hibernatejpadialect.converthibernateaccessexception (hibernatejpadialect.java:277) ~ [пружина-6.14 org.springframework.orm.jpa.vendor.hibernatejpadialect.translateExceptionifpossible (hibernatejpadialect.java:241) ~ [Spring-6.1.14.jar: 6.1.14]
at org.springframework.orm.jpa.abstractentitymanagerfactorybean.translateexceptionifpossible (AbstractentityManagerFactorybean.java:550) ~ [Spring-6.1.14.jar: 6.1.14]
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61) ~[spring-tx-6.1.14.jar:6.1.14]


Caused by: java.sql.sqlsyntaxErrorexception: неизвестный столбец
'у1_0.userid 'в «Полевом списке» at
com.mysql.cj.jdbc.exceptions.sqlerror.createSqlexcept /] ~*mysql-connector-j-8.0.33.jar:8.0.33] at
comm.mysql.cj.jdbc.exceptions.sqlexceptionsmapping.translateexception(sqlexceptionsmapping.java:122)
~ ° Mysql-connector-j-8.0.33.jar:8.8. /> comm.mysql.cj.jdbc.clientpreparedStatement.executeInternal(ClientPreparEdStatement.java:916)
~rmysql-Connector-J-8.0.33.jar:8.0.33] AT
comm.mysql.cj.jdbc.clientpreparedStatement.executequery(ClientPReparEdStatement.java:972)
~rmysql-connector-j-8.0.33.jar:8.0.33] at
comm.zaxxer.hikari.pool.proxypreparedStatement.executequery(proxyprepareDStatement.java:52)
~rhikaricp-5.1.0.jar:na] у
comm.zaxxer.hikari.pool.hikariproxypreparedStatement.execuretquery(hikariproxypreparedStatement.java)
~ /> org.hibernate.sql.results.jdbc.internal.deferredresultsetaccess.executequery(deferredresteSetaccess.java:246)
~ hibernate-core-6.5.3.final.jar:6.3.fic /> < /blockquote>
используемые версии < /strong> < /p>

MySQL Server: 8.0.39 < /li>
Connector: 8.0.31 < /li>
/>spring-data-jpa-3.3.5.

Код: Выделить всё

@Service
public class UserPreferencesImpl implements UserService {
@Autowired
UserPreferencesRepo userPreferenceRepo;

@Override
public StatusResponse addOrUpdateUserPreferences(){
UserPreferences npe = new UserPreferences();
User user = new User ();
user.setUserId("sampele-user-id");
ne.setUser(user);
userPreferenceRepo.save(ne);
}
}
< /code>
repo class < /p>
public interface UserPreferencesRepo extends JpaRepository {

}
userpreferences entity [/b]

Код: Выделить всё

@AllArgsConstructor
@NoArgsConstructor
@Data
@Entity
@Table(name = "user_preferences")
public class UserPreferences implements Serializable {
private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "up_id", unique = true, nullable = false)
private String upId;

@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "User_Id")
private User user;
}
User Entity

Код: Выделить всё

@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@Entity
@Table(name = "user")
public class User implements Serializable {
private static final long serialVersionUID = 1L;

@Id
@Column(name = "User_Id", unique = true, nullable = false, length = 64)
private String userId;

@Column(name = "First_Name", length = 128)
private String firstName;

@Column(name = "Last_Name", length = 128)
private String lastName;
}
< /code>
Опишите user_preferences
| Поле | Тип | Null | Ключ | По умолчанию | Extra |
|: ----: |: ------: |: -----: |: ----: |: ------: |: -----: |
| up_id | bigint | Нет | Pri | [Null] | auto_increment |
| User_id | varchar (64) 
| Нет | Uni | [Null] | | < /p>
Опишите пользователь
| Поле | Тип | Null | Ключ | По умолчанию | Extra |
|: ----: |: ------: |: -----: |: ----: |: ------: |: -----: |
| User_id | varchar (64) | Нет | Pri | [Null] | |
| First_name | varchar (64) | Да | Uni | [Null] | |
| Last_name | varchar (64) | Да | Uni | [Null] | |

Подробнее здесь: https://stackoverflow.com/questions/794 ... ld-list-af

Вернуться в «JAVA»