1. Hibernate/JPA mixing ID generation strategies stackoverflow.comSuppose I have the following situation: I have 5 entities (reduced for the sake of simplicity) of which I unequivocally know that 3 of them will have few records in the ... |
2. JPA ID Generation Strategy stackoverflow.comI defined a generator for a JPA class:
There are cases where I already have an ID for an entity but ... |
3. Hibernate how to prevent duplicate entry with generated id stackoverflow.comIs there a way to prevent duplicate data entry with hibernate on entities that have auto generated primary key? To be more specific, i have a persistent object in the database and ... |
4. Retrieving hibernate generated id coderanch.com |
5. Id generation forum.hibernate.orgHello. I faced with some trouble in primary key generation. What I want to do is to make IDs to be a power of two: 2, (2*2), (2*2*2), ... (2*2*n-times*2) I was failed to find a reference in the documentation. Is there any way to specify my own generator for the object ID? Can anyone, please, point me to an appropriate ... |
6. Migrate to hibernate 3.5 : id generation problem forum.hibernate.orgHello everybody, I recently migrate from hibernate 3.3.2 to hibernate 3.5. But since I have a problem generating my ids. here is my entity : Code: @Entity @Table(name="MRC_EVENTS") public class Event implements Serializable { private static final long serialVersionUID = 1L; @Id private String id; ... In database the id is a ... |
7. About id generation using hibernate and JPA 2 forum.hibernate.orgI'm trying to persist an entity using an identifier that will be generated by our system using custom generation. I'm getting an error because it is trying to get the next sequence... the thing is I'm not using sequence generation, this is my mapping file: Code: |
8. Generated ID after persistance. forum.hibernate.orgI'm not really sure what you are asking, but hibernate id-field could perhaps be used. If you map the property as |
9. Userdefined ID Generation forum.hibernate.orgHi there... I am new to hibernate. I am learning and enjoying it. Please help me with this.. I want to generate a primary key, composed of a sequence value,a fixed string and date. I want to concat these together in a certain manner to form the primary key. How can I do that using @Id and @GeneratedValue annotations??? |
10. Id generation design pattern forum.hibernate.orgHi! We have facing that hibernate use seqhilo algorithm. It is good, but we use envers too. 4 jboss's (not clustered) hit one oracle. Our RevisionEntity's id isn't so timeorder, but envers (3.6) suggest it. If we clustered the Jboss's, are our id's in time order? Is any good solution to keep the fast seqhilo, and keep the timeorder? (With small ... |
11. best way to generate IDs in a J2EE client-server app forum.hibernate.orgHi All, Having a fairly complex object graph and a J2EE client-server with Hibernate coupled only to the J2EE server; the DTOs are passed in the RMI (session bean) calls. The problem is that if I want to change some collection for say, object A and call via RMI the session bean then somehow I need to pass back to the ... |
12. how to generate ids and also references? forum.hibernate.orgI have two tables A and B. B has a foreign key to A. When I use middlegen to generate the Class A and B, Class A has a Set of Class Bs and Class B has a Class A reference. This is good but I would also like Class B to contain the id of Class A. This would allow ... |
13. Is posible to generate this Ids? forum.hibernate.orgHello, I have to change the way that I generate the ids and I have to now if Hibernate can help me. In the past I had to generate the Ids (to record of contracts) in sequence. Then I used MS-SQL with Identity and with the following configuration everything works fine: Code: |
14. No Id is generated forum.hibernate.orgHello Everyone: I have a many-to-one relation between two classes Ticket.java & Queue.java. In my Ticket.hbm.xml I have defined the id generator as follows: |
15. PK/ID Generation Question - Static text + incrementing id forum.hibernate.orgI'd like to have an ID where you have ABC-1 where ABC- is static and the 1 is an incrementing (DB independent, if possible) number. I understand that this will entail using an id generator of type Assigned. My question is, have any of you done an ID like this and if so, how? I'd like to restrict all database access ... |
16. id generation / permission forum.hibernate.orgHi there, if you could post the mapping that is causing the problem would be great. BTW you should take a look at chapter 5.1.4 of the reference doc of hibernate, it should become straight forward afterwards. For Oracle it'll better to use sequence or seqhilo to generate the keys. For me your problem sounds like the table being used to ... |
17. disable id generation forum.hibernate.org |
18. HSQLDB id generation forum.hibernate.orgHello, I generate the database schema from the mappings using the Ant SchemaExport task. To be cross-platform I have picked the native id generator as suggested by the Hibernate reference. According to the documentation "native" means that Hibernate will pick the identity, sequence or hilo algorithm depending upon the underlying database. Everything works fine with PostgreSQL but if I switch to ... |
19. ID generation... forum.hibernate.orgI have this kind of mapping.... Mapping documents: Code: |
20. Hibernate Id generation disabled forum.hibernate.org |
21. one-to-one id generation problem forum.hibernate.orgHibernate version: 2.1.7c I have a situation where I am using a one-to-one mapping in a class, using the generated (native hibernate id generator on mysql) primary key of the left side of the one to one as key for the right (foreign id generator) side. My motive for doing this is that I want the right side to be lazily ... |
22. Can we use id if present and generate one if not present? forum.hibernate.orgHi all, Say, I have a table CAT with a primary key CAT_ID. I need to auto generate CAT_ID using: |
23. Begginer problem with automaticly generating an id forum.hibernate.orgThe problem: I am trying to save an object. I don't really know know how the generators work. As far as I understood there's no need for me to set the id. The generator will take care of that. I tried it with other generators (sequence,hilo,...) but it won't work. The sql-code Code: insert into contact_entrys (organisation, lastName, firstName, middleName, gender, ... |
24. ID Generating ! forum.hibernate.orgCan you explain why you want to manage the surrogate key yourself ? Surrogate keys should be inheritently meaningless, and if the database can generate them all the better, as you don't need to worry about it. If the database supports surrogate key generation natively as in an identity column, why not let the database handle it and get on with ... |
25. Basic question about Hibernate id generation forum.hibernate.orgI'm planning to convert a JDBC application to use Hibernate but I'm really confused about id generation. In the existing application a query of the form: "SELECT id_sequence.NEXTVAL FROM dual" has to be run to get the next available id. I do not understand how a Hibernate id generator is going to know how to duplicate this query unless somewhere in ... |
26. problem in generating ID when usingTableHiloGenerator forum.hibernate.orgI am new to Hibernate stuff. Actually I am using WebSphere5.1.2 and CloudScape V5.1. And I am using dialect as below |
27. Problem in generating ID when using TableHiloGenerator forum.hibernate.orgActually I am using WebSphere5.1.2 and CloudScape V5.1. And I am using dialect as below |
28. one-to-many and generated IDs forum.hibernate.orgbhl wrote: steve wrote: Code: A a = new A(); B b1 = new B(); b1.setA( a ); ... I see; I was thinking hibernate would set the A for me. With that change both sides get persisted correctly. However, I can't use it as that circular reference will cause problems in some unrelated code, which is why I was originally ... |
29. Stoed Procedure an Id Generation forum.hibernate.orgI need to call the following stored procedure to generate a unique identifer. Is there a way I can call this directly from the mapping files. /* * Stored procedures to generate unique keys */ create procedure opc_get_key (@keyname char(10), @newvalue int = -1 output) as BEGIN TRANSACTION UPDATE unique_keys SET keyvalue = keyvalue + 1 WHERE keyname = @keyname SELECT ... |
30. Keep track of generated IDs for Client VOs forum.hibernate.orgHello, The question pertains to a save operation on a new object (Page) which consists of several objects (Samples). Presently, this is the route I am taking: 1. Assign temporary ID to the page and each of its samples. 2. Convert the client-value objects to its corresponding model value objects. 3. Set the relationship within the value objects. 4. Invoke save ... |
31. Hibernate generated id's forum.hibernate.orgprivate long id; @Id @GeneratedValue public long getId() { return id; } public void setId(long id) { this.id = id; ... |
32. id generation with hiberante and non hibernate processes forum.hibernate.orgHello, Till recently I've been using successfully the org.hibernate.id.enhanced.TableGenerator id generator, but now I came across an interesting problem: I have a table that both hibernate and non-hibernate processes access and insert new rows into, possibly simultaneously. Therefore I no longer can use the sequence approach, as the non-hibernate process is not aware of the sequence-like table used by hibernate, and ... |
33. ID generation stategy forum.hibernate.orgHi, I'm developing a project where frequently i need to import existing data from xml files and where all the attributes of the instances, including the id, are already set. To cope with that, i'm using the "assigned" id generation strategy of hibernate. The problem is that i will need to create new instances, and for that i would like hibernate ... |
34. ID Generate using function forum.hibernate.org |
35. Tapping into Hibernate's Id generation mechanism forum.hibernate.orgHello, We have a thick-client application, currently using JDO, that we are in the process of migrating to Hibernate. In our app, when the user creates a new Contact, for example, the generated Id for the new Contact is displayed on the screen. This is achieved by calling into our JDO implementation to get the next available Id: something like - ... |