1. Hibernate getting Id from createCriteria() result stackoverflow.comI have a method that takes a list of entities (
|
2. Hibernate nextval get id stackoverflow.comI use Hibernate with annotations. I need to insert object into the database using a method who needs one parameter that I need to calculate, to do this I use:
|
3. CriteriaBuilder Many-to-one restriction on id stackoverflow.comWhen doing string based queries it is possible to use the "id" keyword on a many-to-one attribute e.g.:
In this case this would generate sql:
|
4. Java Hibernate Id Question stackoverflow.comIs there any way I could generate a four digit number from the AutoGenerated Id that the entity creates? For example: Person has a unique #1. And I would like to create ... |
5. How to get rev id right after auditing when using Hibernate Envers stackoverflow.comI'm using Hibernate Envers for auditing. It works fine. However, I'm try to get the rev id right after modifying the data. I have CustomRevisionEntity as below:
|
6. Denormalizing grandparent id in Hibernate stackoverflow.comI have an object structure like container one:many items one:many pieces of info about items Which maps to 3 tables in my database. ... |
7. hibernate and ids coderanch.com |
8. org.hibernate.QueryException: Not all named parameters have been set + Use of :id coderanch.comHi I am new to hibernate and was trying to one example bellow is my method to retrive a unique record based on the id given as parameter. As you can see inId is the input parameter which i am pasing to my method as parameter. public Module getModule(long inId){ System.out.println("inId : " + inId); Module module = new Module(); try{ ... |
9. user id and password in hibernate config coderanch.com |
10. Hibernate problem Edit ID coderanch.comI have an Object that has a composite ID (made up of three items) FirstName, lastName and SSN. The requirement is that a user can modify the firstName. Considering that the firstName is part of the Primary Key. It means i have to delete the current Object and create a new Object based on the deleted Object. How do I tackle ... |
11. JPA 2 - Defining IDs coderanch.comHi Mike & Merrick, With JPA (prior to JPA 2) we can define object identity as ID Class, Embedded ID (they have their own pros and cons) and directly inside POJO (by ID annotation). Is there any addition/changes for this in JPA 2? And also I'd like to know what is the best strategy for this (there are many disscussions about ... |
12. group ID, hibernate and iceface liferay.comHi all, I need your help. I`m using liferay with hibernate and Iceface and I need to check to witch groups user belongs. I can`t do this in standard JSP way using liferay api becouse all my files are *.jspx and I cant use scripts. I try to download data from database but in this table primary key consist of two ... |
13. discriminating from an id forum.hibernate.orgHi, I have a base class called Person, with a discriminator for Author and User subclasses. Those classes have no extra fields. Lets say I have a personID. What is the easiest way to know whether that is a user or author without a native query? Can I just ask for Person by id, and will Hibernate instantiate as one of ... |
14. Help with Id forum.hibernate.org |
15. how can i have a |
16. Getting the id from an IdentifierGenerator forum.hibernate.orgNewbie Joined: Sat Mar 06, 2010 10:38 pm Posts: 3 Hi All, I'm having this wee problem with accessing a stored procedure via an IdentifierGenerator implemented class, to obviously get the unique id of the table that I'm currently dealing with. I'm using annotations which seems to complicate things further (mainly due to the fact that I'm fairly new to hibernate ... |
17. DefaultMergeEventListener produces copies with empty IDs? forum.hibernate.orgAuthor Message alecbritton Post subject: DefaultMergeEventListener produces copies with empty IDs? Posted: Mon Oct 11, 2010 6:34 pm Newbie Joined: Mon Oct 11, 2010 5:24 pm Posts: 6 Using Hibernate 3.3.2.GA. Hello: When attempting to perform a cascading merge using the mapping below I encountered a NonUniqueObjectException on one of my child collections (DeterminantTypeMember) that has a key-many-to-one mapping ... |
18. Putting @id before variable id OR before getId() method ? forum.hibernate.orgI have seen sample where Annotationsa re put directly before the declaration of the variable and other samples where it is put before the getXXXX() method. e.g. @Id @GeneratedValue(....) private int id; vs: @Id @GeneratedValue(....) publci int getId() { ..... } Is there a difference? I observed that putting the @Column(name = ...) before the getXXX() method does NOT create the ... |
19. DTDEntityResolver:64 - trying to resolve system-id forum.hibernate.orgHello, I am trying to run a backend application (using spring and hibernate 3.0) from another application written in (Struts/Hibernate 3.0 deployed on JBOSS). Both JBOSS and the backend application reside on the same Linux box. When i run the backend application by itself through linux bash script it runs fine but when i call from struts using java.lang.Runtime it hangs... ... |
20. ID size forum.hibernate.orghey, i am trying to configure the hbm class Code: |
21. Multiple @Id problem forum.hibernate.orgHello. I have problem with mapping table without primary key. My table has two columns witch must have unique vale so in fact they are my primary key, booth columns are date type. In class which mapping table I put annotation @Id on booth properties (validFrom and validTo). e.g. Code: public class MyTable { ... |
22. Hibernate picks wrong id forum.hibernate.orgNewbie Joined: Mon Aug 15, 2005 3:43 am Posts: 15 I have two classes mapped like this Code: @Entity public class Media implements Serializable { @Column(name = "media_id") public long getId() { return id; } @Id @Column(name = "release_id") ... |
23. hibernate-2.1final.zip compoiste id Problem forum.hibernate.org |
24. one-to-one and setting FK id forum.hibernate.orgdimas wrote: Still do not understand why you can't move addressId into Persons table. You will be able to update Person object as you wish and address will remain the same. Only when you actually modify any of the Address properties, UPDATE statement will be issued to Address table. The way the db is set up, which I can't change, is ... |
25. Can Example not ignore id? forum.hibernate.org |
26. Assigned ID problem forum.hibernate.orgHi, I have searched the forum extensively but could not find an answer for my question. I have data coming from an XML file which I want to persist. I can use assigned ID's (these come from the data in the XML), but the default behaviour I experience from Hibernate with assigned ID's is that it trys to perform an update. ... |
27. Incorrect id forum.hibernate.orgNewbie Joined: Fri Feb 20, 2004 9:03 pm Posts: 5 Location: Montreal, QC Hibernate version: 2.1.2 Mapping documents: CategoryBean |
28. Id with XDoclet forum.hibernate.orgHow can I get the following mapping by using hibernate xdoclet tags (I am wondering if the hibernate xdoclet plugin even supports it) |
29. is hibernate.id required? forum.hibernate.orgThe documentation says so. However there are times where I don't have a primary key for a table (especially a database view.) I have a few database views that join together data from several tables. The database views do not require a primary key column (or a unique column.) There is no business need for me to add one. I have ... |
30. expecting 'elements' or 'indices' after: comp_id forum.hibernate.orgHello, I am getting an error when i use the following query. Query query = session.createQuery("from com.xerox.hc.model.common.device.DeviceInfo as d where d.serialNumber in (:serialNoList) order by d.DeviceProxyLink.proxyId asc"); Here DeviceProxyLink is the relationship that i have created in the DeviceInfo map. Here is the section of the map. |
31. Usage of Id forum.hibernate.orgI have a simple requirement. Let me put thru an example : class Team { EntityId entityId; String name; } class EntityId { long idValue; } Now, what I want in the mapping file is that it should take long id of EntityId as primary key. As in my current system , we have been using EntityId object for primary key. ... |
32. Does h2.1.2 compare ID in Example? forum.hibernate.org |
33. fix for NonUniqueObjectException with int id forum.hibernate.orgI've set the "unsaved-value" to -1 and initialized the int id with -1 like this: package test.data.hibernate; Code: /** * @hibernate.class * table = "client" */ public class Client{ [b]private int id = -1[/b]; private String name; /** * @hibernate.property */ public String ... |
34. the compisite-id problem forum.hibernate.orgNewbie Joined: Mon Jun 14, 2004 3:29 am Posts: 1 Thank you for help. I have two table.One is "parent" ,another is "child" parent(pid varchar(10),name varchar(10)). pid is primary key child(cid varchar(10),otherid smallint,name varchar(10)). cid and otherid compose the primary key.And cid is the foreign key to the parent table.(but i have not add the FK in the database,I want hibernate ... |
35. Duplicate ids problem forum.hibernate.orgI am working on our project migration from hibernate 1.2 to hibernate 2.1.4. In old mapping files we used |
36. compite-id forum.hibernate.org |
37. where myobject.id in ( myArrayList) forum.hibernate.orgHibernate version: 2.1.6 Hi, Is there anyway i can use existing java collections for the "in" clause ? Say i have an arraylist "myArrayList" with Integers 1,3,5 and i want to return all myobjects with these id's My query would become something like from MyObject as myobject where myobject.id in ( myArrayList ) HQL is all about objects , so i ... |
38. Really using "assigned" ids forum.hibernate.orgIf I use "assigned" ids, saveOrUpdate, and cascaded collections appear to not function with unsaved objects that have their unique ids already assigned. In this sense "assigned" ids appear to be second class citizens. I have an application where I need to be able to send my records from 1 database to another (a sort of home-brewed replication), keeping the same ... |
39. Many-to-many id problem forum.hibernate.orgHello, I have a many-to-many relationship between the A and B classes, where the table in the middle is composed of its id, the id of one side (A class) and the id of the other (B class): Table A_B: ID integer not null (pk); A_ID integer not null; B_ID integer not null; When I try to insert a B object ... |
40. using a CustomType as ID forum.hibernate.org |
41. id element in hibernate forum.hibernate.orgquestion. is it possible to specify an identifier with a custom type, as opposed to the normal types supplied by hibernate, e.g. int, string?? In one of my POJO classes, I have a primary key field that has a custom type called "Identifier". Inside this Identifier object I have other types, such as digit, code, etc. I am wondering whether this ... |
42. Problem with assigned id. forum.hibernate.orgThis is sort of "half a problem" I have an object with assigned id. When I create the object and give it an assigned ID, and save the object It throws the stacktrace below *BUT* everything get's saved in the database as I intended. So it's working, I'd just like to stop the error from happening. Hibernate version:2.1.5 Mapping documents: Code: ... |
43. Incremental ID and assignment forum.hibernate.orgThank you david but im a newbie user and need some explanation about how Hibernate assigns an Id, how it works. I did not find anything about my question. Suppose i have two users doing an insert operation in different web transaction. operationOne session.save(objectOne) 1) now Hibernate goes to database select max id, add one and sets it to the object ... |
44. Strange problem: Cannot get ID forum.hibernate.orgDo you get any results in your Iterator it, what is the size of it. But if you want to check the quick alternative to get the same thing you are doing, you can try this :- List results = session.createCriteria(Paper.class) .add( Expression.eq("userid", Obj.getUserID())).list(); And then iterate as you were doing, hope you will get the required results. |
45. Get problem with an undefined id forum.hibernate.org |
46. Newbie question about ID's forum.hibernate.orgA very simple newbie question: I'm using Hibernate 3. For every class I specified an unique identifier via the id tag in my mapping. Do I have to include this identifier (named id) as an attribute in each class or isn't that needed? In all the Hibernate tutorials I read they do that but it would be easier to forget it ... |
47. what kind of Id genernator should I use? forum.hibernate.org |
48. Best practices for assign id ? forum.hibernate.orgI'm using |
49. one-to-many with different IDs forum.hibernate.org-------- ----------- ----------- |Job | |Prop | |Number | |Job_id|------->|Prop_id |<----|Number_id| |... | | |Prop_type| |... ... |
50. Is there a way to identify code changes by JIRA bug id? forum.hibernate.org |
51. how to deal with propagating IDs via webservice? forum.hibernate.orgCopy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved, save a copy of and return it as a newly persistent instance. The given instance does not become associated with the ... |
52. Composed-id problme forum.hibernate.org |
53. do not want to use autogenerated id forum.hibernate.orgHi, I am using a table named vehicle in my application with a unique value licenseNo(entered by the user). I tried to use that as the primary key instead of adding another variable vehicle_id which is auto-generated. But this did not work i was having problem saving the class. I did not want to use the autogenerated id because in all ... |
54. Solution for the hard to understand problem of id changing forum.hibernate.orgCaused by: org.hibernate.HibernateException: identifier of an instance of |
55. Assigned IDs forum.hibernate.orgHi, I have a column in a table where the key is provided by a third party. This key is guarenteed to be unique and I tend to get a lot of rows to upload in one go (many thousands). If I create the new object to be persistent, and then try to save it, then hibernate will automatically try to ... |
56. How can I avoid adding "id" to my interface? forum.hibernate.orgpublic interface Employee { public double getSalary(); } public class SalariedEmployee implements Employee { private Long id; private double salary; public Long getId() { return id; } public void setid(Long id) { this.id = id; } public ... |
57. how to define the id index name forum.hibernate.orgI chosen seqhilo for compatibility reasons (works also in postgresql), but yes currently it makes sense to switch to a pure sequence aproach in my case. And im using artificial ids because i wanted to use them instead of compositeid. But when i use an artificial key the natural multi-column unique constraint will be still there => i know how to ... |
58. id of 0 forum.hibernate.org |
59. confusion about the need and use of assigned id's... forum.hibernate.orgHibernate version: 3.1.2 Hello, This is more of a general question that I can't seem to find an answer for anywhere: can someone explain to me the whole deal with ID generation ?... Let me elaborate on that... I worked with databases before so I know what an ID is and I know the issues with java collections and changing objects... ... |
60. Will Fix IDs forum.hibernate.org |
61. ID Considerations forum.hibernate.orgHello guyz, I'm working on the development of a huge project, and all my entity classes will use the same ID generator. All entity classes extends a MappedSuperclass, where the id is declared. I'm opening here a discussion on advantages and disadvantages of uuid, sequence and sequencehilo generators. We're using Oracle. Currently all our entities implement a superclass, and this superclass ... |
62. "id" doesn't work, is this a bug? forum.hibernate.org |
63. Problem of Id forum.hibernate.orghello I've got a problem when i try to insert into my database with hibernate. I'm a beginner so i try on this small project to understand hibernate. i use a MYSQL database and this bean Code: public class personne { private int id; private String nome; ... |
64. Denormalize grandparent's id in grandchildren forum.hibernate.orgHi, Can someone tell me if it's possible to pull grandparent's generated id and have it persisted in the grandchild. Here is the scenario: GrandParent->Parent->Child Each class declares a generated id as primary key: |
65. One-To-One with a compound id.. Anyone.. forum.hibernate.orgDoes anyone have an example of a mapping implementation where the id is a compound Id. I followed the example provided in the docs using the special generater "foreign" and that works great for a single column id but i just cannot get it to work with a compound Id? An example would be greatly appreciated... |
66. Which is the best strategy for retrieving the smallest c_id forum.hibernate.orgHello, I'm trying to implement a FIFO process. I need to always extract the row with the smallest c_id value. My first guess was to use a sql query with a subquery. select * from table where table.id=( select min(table.id) ); I have searched the forums, but I have not found anything at all. Thanks, Sid |
67. Problem using Critera & adding a Restriction to an ID co forum.hibernate.orgNewbie Joined: Thu May 10, 2007 4:12 am Posts: 3 I am having problems in Hibernate when searching with Criteria and adding an ID Restriction. Oracle throws an ArrayIndexOutOfBoundsException, which is eventually thrown by Hibernate as a GenericJDBCException. My finder method works fine when adding normal (non-id) restrictions. However, when I try to add a restriction for an ID field, it ... |
68. Problem in DefaultMergeEventListener when using primitive id forum.hibernate.orgHi I am having trouble when using the Session.merge() method on transient entities which have primitive identifiers. The DefaultMergeEventListener class throws a nullpointerexception in the line: entry = source.getPersistenceContext().getEntry( managedEntity ); This is due to the fact that the EntityPersister.getIdentifier() has returned an identifier of value 0, (value of a transient primitive identifier), as opposed to null, (value of a transient ... |
69. Is there any efficiency problem using assigned id? forum.hibernate.orgI was using auto sequence to generate id before: |
70. one-to-one with shared id forum.hibernate.orgHi, I have a strange situation in my Hibernate application: I have a class Person, which has a field called Representant. Representant may be sometimes null and if it is not - representant id is always the same as person's id. class Person { ... private Representant representant; ... } in my hbm.xml file this association is defined as: |
71. One-to-one referred by ID only forum.hibernate.orgI have a situation of one-to-one relationship that I prefer the child class is referred with its ID instead of object on its parent class for the following reason: When the parent object is retrieved along with the child, two DB trips are need: first to get the parent object and second to get the child object. The child object is ... |
72. id setting issue forum.hibernate.orgericp wrote: Can you post the contents of the Event class and the top element of you hibernate mapping file i.e. |
73. Hibernate Filters and retrieval by id forum.hibernate.orgHello, I am using Hibernate with Seam to build a prototype for a multi-tenant application. Things are working well thanks to the integration of Hibernate filters within Seam. Now, one drawback in the current set-up is that users can still fetch entities that do not correspond to their tenant filter criteria. This is wanted behaviour as discussed previously in this forum ... |
74. ID Problem forum.hibernate.orgHi I am trying to generate the Id from a single oracle sequence. Problem is the ID value generated by the hibernate query is different from the one saved in DB. e.g. If hibernate query generates the ID_SEQ.nextval = 22 for CustomerID the saved value for the same field is 23 in DB. Interesting thing is when i save the Employee-Address-Contact ... |
75. Problem with negative ids forum.hibernate.org |
76. set an id based on GeneratedValue forum.hibernate.org |
77. how set the ID in hibernate forum.hibernate.org |
78. Application assigned id's documentation forum.hibernate.orgHi, all. We are using Hibernate 3.3.2. For various reasons, we're transitioning to application-assigned id's in our app. We use Hibernate as the JPA provider, marking our entities with JPA annotations. What we are seeing with application assigned id's is not matching with the documentation. We actually like what Hibernate appears to be doing rather than what the documentation says will ... |
79. Getting the autogenerated ID when using SQLQuery forum.hibernate.orgHello, I have a problem when trying to get the last inserted ID's for manually exectued SQL queries when using the SQLQuery class. The table i'm querying gets created at runtime and the columns it contains can change at a moments notice so i can't use traditional pojo/entity classes for this table. The code listed below works fine when inserting records ... |
80. SubCriteria Example not including ID forum.hibernate.orgI am trying to get the children of a parent filtered using an Example - I make a Criteria and add my child_Example. Then add a new Criteria for the parent and add my parent_example. All the fields from the parent are added to the join except ID - why is that? |
81. SequenceStyleGenerator using invalid IDs forum.hibernate.orgHello, I have 2 objects that both inherit from a base object that uses a generic ID generator defined like this: @GenericGenerator(name="peeringobjectgenseq", strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator", parameters = { @Parameter(name = "sequence_name", value = "PEERINGOBJECT_SEQ") , @Parameter(name = "increment_size", value = "10") , @Parameter(name = "optimizer", value = "pooled") } ) In my application, one of the objects is inserted using LOAD ... |
82. Increase id manually? forum.hibernate.orgHallo! I have the following problem: I load an object from the database. If I save the same object (never mind if I change attributes or not) I want hibernate to increase the id, i.e. hibernate should put a new object in the database and not just the same! how can i realize that? Thank you very much! |
83. Problem regarding @Id forum.hibernate.orgHi All, I have a little doubt regarding @Id @GeneratedValue For the following scenario I have a table name called Abc in my project which contains @ID column And that project Runs Simultaneously at two different instance in isolation after every week these two instance's DataBase gets aggregate at one location. Now at both the instance @Id has been generated automatically ... |