I am using Hibernate(3.0) + Oracle DB (10g) for my application.
My domain object are like PluginConfig.java
@Entity
@Table(name = "plugin_config" , schema = "test")
@org.hibernate.annotations.Cache(usage =org.hibernate.annotations.CacheConcurrencyStrategy.READ_WRITE)
public class Config {
private static final long serialVersionUID = -1959019321092627830L;
/** This object's id */
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
protected long id;
@OneToOne
@JoinColumn(name = "plugin_id")
private Plugin plugin;
@Column(name = "config_name")
@NaturalId(mutable = true)
private String name;
@Column(name = "config_desc")
private String description;
another domain object Plugin.java
@Entity
@Table(name = "plugin", schema = "test")
@org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.READ_WRITE)
public class Plugin implements Serializable {
private static final long serialVersionUID = 5694761325202724778L;
/** This object's id */
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
protected long id;
@Column(name = "plugin_name")
@NaturalId
private String pluginName;
@OneToOne
@JoinColumn(name = "plugin_config_id")
private PluginConfig pluginConfig;
@Column(name = "plugin_desc")
private String description;
Whenever i try to load Plugin via my database service method(using @Transactional annotation and hence it loads all its children as well) i get the following error
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [PluginConfig#53]
There is actually no row in plugin_config table with id = 53.
And also no plugin table entry has plugin_config_id=53.
So from where is hibernate picking these values ? I noticed one thing here, the value "53" is actually the row number from the plugin_config table which should have been reffered.
See the below image:

This is the plugin config that my query should be looking for. But it tries to search it with identifier #53(Row no:) instead of the #95(value of the primary key "id").
Where can i be going wrong with this ?
plugin_config_idexists at all? How are you trying to load the entity in theplugin_configtable?