value « Key « JPA Q&A





1. Why the value of the foreign key is always zero?    stackoverflow.com

I try to build some application using hibernate for persistence (my first one). The application has genres and books. The genre class has a set of books. But every book in ...

2. JPA primary key value is always 0    stackoverflow.com

I have a post class and it kind of works, but there's one problem: the primary key doesn't increase.

@Entity
@Table(name="posts")
public class Post extends GenericModel{

    @Id
    @Column(name="post_id")
 ...

3. Can I change the value of the PK (Hibernate)    coderanch.com

I have a class whose primary key is a String property. The initial value of the PK is set in a business rule. Now there is a rule to change the value of the primary key while keeping all the child records. The database constraints allow that (foreign keys with "on update cascade" option). So all I did was change the ...

4. Hibernate not picking values from PK    coderanch.com

Hello World, I am new to Hibernate. I have created composite primary key like And my Primary Key class like public class ApplicationPK implements Serializable { private int alertId; private int cn; //getter setter for above fields. } And POJO class looks like this ...

5. Access to key values from proxy on many to one ?    forum.hibernate.org

Yes, there is a difference. Access to fields can't be intercepted by proxies. Hibernate can't really know that the getOrderId() method is related to the orderId field, so I think Hibernate then initializes the proxy on any method call. I remember seeing some information about it, but right now I can't find it again.

6. Hibernate re-uses key value for returned object: Switch off?    forum.hibernate.org

My MySQL database is configured to use case insensitive searches. session.load/get seems to re-use the key value for the object that is returned: session.get(User.class, "bob").getName() returns "bob" even if the users.name primay key column in the database contains "BOB". Hibernate saves on only fetching the other columns. Can this behaviour be switched off somehow? I'd like to authenticate users case-insensitive with ...

7. constant value in many-to-one but wrong 'primary key'    forum.hibernate.org

Hibernate version: 2.1.6 Mapping documents: only parts showing the relevant things ... i hope i have correctly pasted them ... that works, but with the wrong primary key: Part of Mapping for Class A: Code: ...

8. How TO: Deep copy instead of a reference (foreign key) value    forum.hibernate.org

Hibernate version: 2.1.7 Name and version of the database you are using: MySQL Hi All. I have two simple Hibernate bean classes: Fault.java and Revision.java Fault class maps to FAULT table, and Revision class maps to REVISION table. Fault.java contains these 3 properties: int id (primary key) String synopsis (nullable varchar) Revision revision (not sure if I can do something like ...

9. Changing value of the primary key    forum.hibernate.org

So, I read on the website that you can not, and should not, change the primary key and that hibernate will not allow you to do that. Is this right? Lets say I want to update the value of the PK of a building, say its name. If the building name is the PK I can't change the name, even if ...





11. need to store a 128bits hash value as primary key    forum.hibernate.org

So far I could only see 2 solutions: - use a 16 length string: but since the underlying DB is in UTF-8 (for some other reason), it means my key will be 32 bytes long, which is twice larger than what I need. - use a composite-id of 2 long to map my 16 bytes key. Both solutions seems suboptimal too ...

12. How to create primary key value using function    forum.hibernate.org

Hey, I am using hibernate 3.1.3 version. I have a USER table in oracle database with two fields OJBECTID and NAME. I have created a function "createObjId(arg1, arg2)" in oracle to generate a primary key value (for OBJECTID field). My question is in mapping file how I can call this function so that an id can be generated using this function ...

13. "values" and "keys" in MetaType PRIVATE?    forum.hibernate.org

I need to get the metavalues out of the MetaType to get infos about the possible classes for an any type member. But these infos are private. I can only get the infos from the "any" class, but i need to receive them without having a specific "any" object. Can you just make these infos public in MetaType? Thanks.

14. problem with primary key values in hibernate    forum.hibernate.org

Hello Friends I am new to hibernate I have taken this example from hibernate quickely, I am using oracle 10 g. I have a problem when I run the EventLoader It inserts the values into database but the values inserted into to the database are unpredictab. Explanation of problem is as follows: there are two tables 1. Events 2. Locations Event ...