Reputation: 819
I created a simple spring mvc web app with hibernate
and mysql
(Everything worked well). Then, I changed mysql
to oracle
. After first run of the application, (connected to oracle database) tables, corresponding to the entity models defined in my application, were created. I added one country and one user to COUNTRY
and MYAPPUSER
tables from SQL DEVELOPER
. Now, I am trying to get a user from MYAPPUSER
table but I am getting null instead of user, which exists.
This is User entity:
@Entity
@Table(name = "myAppUser")
public class User {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "id_Sequence")
@SequenceGenerator(name = "id_Sequence", sequenceName = "ID_SEQ")
@Column(name = "Id", updatable = false, nullable = false)
private int id;
@Column(name = "FirstName")
private String firstName;
@Column(name = "LastName")
private String lastName;
@Column(name = "Username")
private String username;
@Column(name = "Password")
private String password;
@OneToMany(mappedBy = "user")
private List<UserSubject> userSubjects;
@ManyToOne
@JoinColumn(name = "country_id", nullable = false)
private Country country;
@OneToMany(mappedBy = "user")
private List<Test> testList;
//and getters and setters
}
This is code while debugging:
In sql developer:
this is generated sql by hibernate:
I am interested in why user is null after selecting data and why question marks are in place of user1
and 123
in generated sql?
I think this effect is specific to oracle, because I had not such problem with MySQL database.
P.S Exceptions aren't thrown....
Upvotes: 0
Views: 683
Reputation: 64959
From the comments the solution was to commit in SQL Developer.
Upvotes: 1