Вне зависимости от попыток что-либо изменить вылетает одно и та же ошибка.
@Entity
@Table(name = "services")
public class Service {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name = "userid")
private Long userId;
@Column(name = "service_name")
private String nameOfService;
@Column(name = "cost")
private Integer serviceCost;
@Column(name = "category")
private String category;
@Column(name = "description")
private String description;
@Column(name = "country")
private String country;
@Column(name = "city")
private String city;
@Column(name = "type_of_service")
private String typeOfService;
@Column(name = "currency")
private String currency;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
private User user;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getNameOfService() {
return nameOfService;
}
public void setNameOfService(String nameOfService) {
this.nameOfService = nameOfService;
}
public Integer getServiceCost() {
return serviceCost;
}
public void setServiceCost(Integer serviceCost) {
this.serviceCost = serviceCost;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getTypeOfService() {
return typeOfService;
}
public void setTypeOfService(String typeOfService) {
this.typeOfService = typeOfService;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name = "username")
private String username;
@Column(name = "password")
private String password;
@Column(name = "is_registration_confirmed")
private Boolean isRegistrationConfirmed;
@Column(name = "key_for_registration_confirm")
private String keyForRegistrationConfirmUrl;
@Column(name = "login")
private String login;
@Column(name = "date_of_registration")
private Date dateOfRegistration;
@Transient
private String confirmPassword;
@Column(name = "first_name")
private String firstName;
@Column(name = "gender")
private String gender;
@Column(name = "date_of_birth")
private String dateOfBirth;
@Column(name = "country")
private String country;
@Column(name = "path_to_avatar")
private String avatar;
@ManyToMany
@JoinTable(name = "user_roles", joinColumns = @JoinColumn(name = "user_id"),
inverseJoinColumns = @JoinColumn(name = "role_id"))
private Set<Role> roles;
@OneToMany(mappedBy = "user", /*cascade = CascadeType.ALL, */fetch = FetchType.LAZY/*, orphanRemoval = true*/)
private Set<Service> services;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Boolean getRegistrationConfirmed() {
return isRegistrationConfirmed;
}
public void setRegistrationConfirmed(Boolean registrationConfirmed) {
isRegistrationConfirmed = registrationConfirmed;
}
public String getKeyForRegistrationConfirmUrl() {
return keyForRegistrationConfirmUrl;
}
public void setKeyForRegistrationConfirmUrl(String keyForRegistrationConfirmUrl) {
this.keyForRegistrationConfirmUrl = keyForRegistrationConfirmUrl;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public Date getDateOfRegistration() {
return dateOfRegistration;
}
public void setDateOfRegistration(Date dateOfRegistration) {
this.dateOfRegistration = dateOfRegistration;
}
public String getConfirmPassword() {
return confirmPassword;
}
public void setConfirmPassword(String confirmPassword) {
this.confirmPassword = confirmPassword;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(String dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public Set<Role> getRoles() {
return roles;
}
public void setRoles(Set<Role> roles) {
this.roles = roles;
}
public Set<Service> getServices() {
return services;
}
public void setServices(Set<Service> services) {
this.services = services;
}
}
Ошибка:
16:22:30.763 [http-nio-8087-exec-7] ERROR o.h.e.j.s.SqlExceptionHelper#146 Unknown column 'service0_.user_id' in 'field list'
Попробуйте использовать @OneToMany(**targetEntity** = Service.class...
вместо @OneToMany(**mappedBy** = "user"...
Айфон мало держит заряд, разбираемся с проблемой вместе с AppLab
Перевод документов на английский язык: Важность и ключевые аспекты
Товарищи! Как можно вывести на экран числа AF при переводе числа из 10-ной системы счисления в 16-ную, если if/switch и строки использовать нельзя?
Мне нужен метод проверяющий что база даных существует чтобы если вернется false сделать create database
У меня в приложении есть NotificationActivity, которая вызывается собственно из NotificationИ после того как она сработала, если пользователь захочет открыть...