attribute 3 « Map « JPA Q&A





1. Question on mapping tag attributes...    forum.hibernate.org

2. org.xml.sax.SAXParseException: Attribute "name" mu    forum.hibernate.org

Hibernate version: 2.1.6 I have following mapping files User mapping file contains list of orders (one to many) Order contians( many to one) I am getting invalid mapping exception I don't know where i am going wrong mapping documents UserData.hbm.xml

4. Problem with the cascade attribute when using arrays    forum.hibernate.org

When I set the cascade attribute to all-delete-orphan for an array I get a SAX parse exception. I checked the dtd and it doesn't allow this value for arrays... Is there a work around? We are using the element because we were getting serialization issues when using Set. Thank you, Peter

5. property-ref attribute being ignored in join, is this a bug?    forum.hibernate.org

Thanks for the information. It's not in the doc - but in the dtd. I guess your statement applies also to ? Is there a chance to those implemented in the near future? It would be really helpful, especially when mapping legacy data (with composite db PKs where one attribute needs to be generated - and only with ... ...

6. How to fetch from DB only few attributes instead all    forum.hibernate.org

Thank you for advice. First we have to confirm that "fetch time" is a issue in production environment. If yes we will use your advice. As I've promised at the and of the our project I will write short article about processing huge numbers of data using Hibernate ,- we have many advices that can be helpful for others. Currently our ...

7. Filtering parent objects by child attributes via HQL    forum.hibernate.org

Hi Anthony, Your HQL is working fine but returning duplicate records of parent as relation is many-to-one from child, so I applied distinct over parent selection then it works fine. but the query results should be paginated as it could be big. so when I applied "Query.setMaxResults" on the query generated SQL distincts over row number and again I got duplicates! ...

8. Parameterized forumla attribute    forum.hibernate.org

Hi Grimace, I never received an answer to my original query, so in the end we solved the problem using views. So, let's say that I have table A, with columns A,B,C. When I select from this table I want to also retrieve the result of calling function F. Now, I can get the values for function F from the columns ...

9. Map a string table's field to more than one class attribute    forum.hibernate.org

Hi, I'm doing my first work with Hibernate(3)+Oracle(9)+Tomcat(4.1) using the Ecplise IDE. This is my problem: I have a table with a String DATE field, I'd like querying it by a substring of this field (eg:SELECT or GRUOP BY by mounth,or by day, etc). I read in this forum that HSQL don't support string function like substring, so I would have ...





10. SAXParseException: Attribute "column" must be decl    forum.hibernate.org

I get the following error when attempting to create a one to many relationship between 2 classes SAXParseException: Attribute "column" must be declared for element type "one-to-many". I'm pretty new to Hibernate. I'm using hibernate 2.1. What am I doing wrong?

11. insert/update attribute of id element    forum.hibernate.org

Newbie Joined: Thu Sep 16, 2004 4:35 pm Posts: 6 I am getting an error suggesting that I need to declase the insert and update attribute for my id element. The problem is that I already have those declared in my mapping. I have tried setting them to both true and false, without any change. ERRORS: 2005-03-09 16:11:44,451 ERROR [net.sf.hibernate.util.XMLHelper] Error ...

12. Is where attribute in class mapping ignored?    forum.hibernate.org

14. Element does not allow attribute "name&qu    forum.hibernate.org

16. extra relationship attribute in relastionship table    forum.hibernate.org

Hi, I am new to Hibernate, sorry if I use the terminology wrong. I am trying to use set to represent the following diagram. It shows the relationship between JOBS and EMPLOYEES. The relationship is JOB_HISTORY. The problem I am facing is I have one extra relationship attribute (START_DATE) in the JOB_HISTORY table compare to other set examples in the Hibernate ...





17. How-to: Class attribute mapping from a different table    forum.hibernate.org

Hibernate version: 3.0 Hello All, I think this should be a very simple problem, but I seem to be having some difficulty finding the right solution. Let's say I have two database tables: TABLE and TABLE_TYPE (i.e a dining room table, etc.) TABLE has a few attributes: ID, NAME, TABLE_TYPE_ID (FK), etc. TABLE_TYPE has three attributes: TABLE_TYPE_ID (PK) , NAME (dining ...

18. createSQLQuery, can it return signle attributes    forum.hibernate.org

19. Many-to-Many with attributes to assoc. Need cascade delete    forum.hibernate.org

Hi all, I have a case as follows: Table A and table B have many-to-many relationship. The association table AB has (extra) nullable attributes. I tried to use "composite-element" as follows: AB is modelled as a composite element in A. AB has reference to B. Now if I delete an entry of AB from A, corresponding entry from table B is ...

20. return an object based on attributes of it's children    forum.hibernate.org

I've got a general question about using HQL. I've got an object called schedule which contains a collection of events. Each event needs to be validated before the schedule can be approved so I have a Boolean flag on the event to determine if it has been passed. What I need to do is search for the earliest schedule in the ...

21. Formula attribute in property giving an error.    forum.hibernate.org

Hi, My project is using springframework & hibernate. In one of the mapping files, i have a requirement of a field in xml, which should not be mapped with any column of database but should be the sum of four columns of database. the code is as follows     forum.hibernate.org

I get the following exception when i try running a simple test program against an oracle database... any ideas net.sf.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Cannot configure CacheManager: file:/C:/Eclipse/workspace/CommonRolesProject/bin/ehcache.xml:51: Element does not allow attribute "diskPersistent". at net.sf.hibernate.cache.EhCacheProvider.start(EhCacheProvider.java:127) at net.sf.hibernate.cfg.Configuration.configureCaches(Configuration.java:1133) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:804) at com.kraft.util.CreateTest.main(CreateTest.java:20) Caused by: net.sf.ehcache.CacheException: Cannot configure CacheManager: file:/C:/Eclipse/workspace/CommonRolesProject/bin/ehcache.xml:51: Element does not allow attribute "diskPersistent". at net.sf.ehcache.CacheManager.configure(CacheManager.java:157) at net.sf.ehcache.CacheManager.(CacheManager.java:128) at net.sf.ehcache.CacheManager.create(CacheManager.java:180) at ...

24. Attribute "type" must be declared for element type    forum.hibernate.org

hello, i'm using Hibernate 3.0.4 and oracle. i got this Group class with the following mapping: Code: ...

25. Searching sublist by attribute with Criteria    forum.hibernate.org

Newbie Joined: Fri Aug 13, 2004 11:41 am Posts: 9 Hibernate version: 3.X Mapping documents: Code: ...

26. Error : Error parsing XML: XML InputStream(20) Attribute &qu    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.0 Mapping documents:

27. Manay-to-many reln when reln table has another attribute    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp I am facing problems with many-to-many relationship in tables where the relation table has an attribute other than the composite primary key. I am using Spring 1.2 ORM package for hibernate. Things are fine when the relation table contains only the composite key. The hibernate documentation also talks about the same; ...

28. how can I change the value of cascade attribute on runtime    forum.hibernate.org

Ok, i agree, I am new student in this world and i want to learn most is possible but i think if i can change tha map file relationed with specific bean object in one xml has a cascade="save-updated" set and similary another xml with cascade="save" set then i can do what i said before. tell me what about is

29. reading cascade attribute using meta api    forum.hibernate.org

30. Accessing attributes directly    forum.hibernate.org

Hi, I've got a problem with my POJOs. I'd like to access the attributes directly without using my setter-methods. In the documentation, there is written several times that it is possible to do that, but after having searched half the day, I haven't found how to do so. Can anybody help me, please? Thanks a lot, Felix

32. Object attribute value keeps changing after update????    forum.hibernate.org

Env: Hibernate 3.0.5 and MySQL 4.0.21 on MacOS X 10.4.2, running in Tomcat 5. I am having small issue where my Object seems to to have a different attribute value every time I do a query on it, after having updated its value. For example, if I update the value 5 times and then do a query 10 times, then returned ...

33. Group by and attributes    forum.hibernate.org

34. Stored procedure returns only some attributes    forum.hibernate.org

Hi, I am calling a stored procedure that selects with a join and returns columns from both tables: CREATE OR REPLACE FUNCTION FIND_STAGE_TWO_AUDIT_STATIONS RETURN SYS_REFCURSOR AS st_cursor SYS_REFCURSOR; BEGIN OPEN st_cursor FOR select shl.STATION, shl.AREA_MGR_CODE, shl.ZONE, shl.REGION, shl.STATION_DESC, shl.STATION_MGR_NAME, shl.STATION_MGR_LID, shl.STATION_STATUS, shl.AREA_MANAGER_NAME, shl.AREA_MGR_LID, shl.ZONE_DESC, shl.ZONE_MGR_NAME, shl.ZONE_MGR_LID, shl.REGION_NAME, shl.REGION_MGR_NAME, shl.REGION_MGR_LID, shl.WH_UPDATE_DAT, shl.STATE, shl.STATION_P, shl.STATION_N, AM.AUDIT_ID as AUDIT_ID, AM.STOP_DATE as STOP_DATE, AM.Status_TYPE_ID as ...

35. Mapping many-to-many relationships from a common attribute    forum.hibernate.org

I have two sets of data types and associated tables: brother's and sisters. Each data type has a parent id and contains a collection of siblings of the opposite gender. Therefore, there is a many-to-many relationship between the brothers and sisters. This relationship is based on them sharing a common parentId attribute -- i.e. I am not using a join table ...

36. "Where" attribute on collections not actually impl    forum.hibernate.org

Section 7.2 of the Hibernate reference manual says that you can add an arbitrary SQL where clause to control what elements of a collection are returned: Quote: where (optional) specify an arbitrary SQL WHERE condition to be used when retrieving or removing the collection (useful if the collection should contain only a subset of the available data) I have a mapping ...

37. Join with extra attributes    forum.hibernate.org

I've been doing searches looking for best practices for 3-way joins too. At the moment I have a class representing a join of 2 of them, and then map that to the third. In your example it would be a PersonDay class, of which there would be 7 per person (Joe-Mon, Joe-Tue, Joe-Wed,...Fred-Sat, Fred-Sun,...Jim-Mon,...)

38. one-to-many without back link attribute?    forum.hibernate.org

This is simple, the OR mapper adds a reference column to the B-table (b_Id) without adding an attribute to the B-object. The get operation selects all from b-table with b_Id = a_Id. The set operation could be implemented similar. Your question answers my original question, Hibernate forces the relational model to the object model. The object model uses a uni directional ...

39. Mapping Map Attribute    forum.hibernate.org

40. dealing with a many to many relationship with attributes    forum.hibernate.org

The best way to explain my questions is with an example... I have three classes(tables): Person, Event, and Event_Person. The reason for Event_Person is to break up the many to many relationship between Person and Event. The reason I am manually creating the table is because I would like to place attributes in that table (these attributes dont relate to any ...

42. Attribute names conflicting with keywords in HQL queries?    forum.hibernate.org

I am having trouble running an HQL query in which i refer to the right property of one of my persistent beans. Apparently, "right" is an HQL keyword, which i guess is the reason why my query won't run (details below), and besides, the same query works fine if i rename the right property of my bean into something else. I ...

43. Can I put runtime values into where or formula attributes?    forum.hibernate.org

I have a normal one:many relationship (IPRouter to configuration) in the database suitable for mapping with the element. However I know that I will only ever retrieve one value from this map: the map-key will be a date, which will always be provided. My current approach is to not provide the getMap() method in the router's interface; I'm storing the ...

44. Using entity-name attribute makes save(Object) impossible ?    forum.hibernate.org

Caused by: org.hibernate.MappingException: Unknown entity: it.xxx.sce.model.MovimentoStandard at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:569) at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1086) at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180) at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:409) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:82 ) ...

46. Reading attributes that are mapped to DB.    forum.hibernate.org

47. Query on some attributes    forum.hibernate.org

In an example, I have a class that has the attributes: id, name and listCodes. I just want to perform a query that my objects cames with the properties id and name populated, assuming that my list are huge lists and I dont want to use them. There is any way of doing this? My reference to the list to each ...

49. Lazy attribute behaviour in parent-child relationships    forum.hibernate.org

Hi! I have a general question regarding the behaviour of lazy attribute settings. I couldn't find an answer to that neither in the Hibernate reference, nor in "Hibernate in Action". - I have an entity A with a collections of B entities declared as lazy - The entity B has further sets declared as non-lazy The problem is that when I ...

50. Initialising UserType but need attribute from owner    forum.hibernate.org

Hi All, I have a mapping file, an extract of which is below: Code: ...

51. Change in behaviour of where attribute since 3.0    forum.hibernate.org

Hibernate version: 3.1 Hello, We have a setup that used to work fine in Hibernate 3.0, but the behaviour appears to have changed in 3.1 onward, and our code no longer works. Its a class that has a few bags that each have a where= attribute, to apply a filter on the selection. Since 3.1, hibernate is modifying this sql to ...

52. Attribute "generated" must be declared for element    forum.hibernate.org

WSAD, Hibernate 3.0 Really strange exception. When the hmb file is changed from: ..... to ...

53. Custom attributes at runtime    forum.hibernate.org

I want to allow the user to add custom attributes to various entities at runtime. For example, they can add a new field "Birthday" to an "Employee" entity. I want to map these custom attributes (which will likely be stored as name/value pairs) to some separate tables that will store custom attributes. Is there any way to allow mapping of such ...

54. Searching attributes in objects that are in collections    forum.hibernate.org

I've got an object called ChangedSection that contains a Revision. The Revision contains a set of Statuses. A Status has a String that may be "Open" or "Closed". I basically want all ChangedSections that contain a Revision with a status of open. I want to do something like this: from com.company.ChangedSection as changedSection where changedSection.revision.status.name='Open' Is is possible to search for ...

55. OrderBy by attribute of a dependent table    forum.hibernate.org

57. attribute doesnt exist error !    forum.hibernate.org

58. many-to-many associations and extra attributes    forum.hibernate.org

Hi All, I have must what be a common problem and I found some indication of how togo about this in the Tips & Tricks but it didn't make sense to me... so example tables : Title (id,name) Contributor (id,name) TitleContributor (id,titleid,contributorid,role) Role(id,name) I'm sure that you understand the relationship above and that TitleContributor is the intersection table between Title & ...

59. Cascade attribute setting for one-to-many relationship    forum.hibernate.org

Hi, I have a one-to-many relationship, say Order to Orderlines. Is it possible to define the cascade attribute for this relationship so that if the last Orderline object is deleted then the Order is also automatically deleted? Obviously, deleting any Orderline object except for the last one would not delete the Order. Or is this something I can only do programmatically? ...

60. [HQL] Select an element in a map attribute    forum.hibernate.org

... ...

61. xdoclet, one-to-many with attribute -Hibernate in Action ch6    forum.hibernate.org

Hi. I am trying to use xdoclet to create a one-to-many relationship with an attribute, just like in chapter 6 of Hibernate in Action (p. 229). I am using a composite element, an intermediary Java class. I have the following: Module.java long id String description List pieces Piece.java long id String description ModulePiece.java Module module Piece piece int quantity ... so ...

62. XML To Database Mapping for Attributes    forum.hibernate.org

63. Mapping two object attributes to one column in a table.    forum.hibernate.org

Try to change the insert and update attributes also on many-to-one Code:

64. Info about proxy attribute of class    forum.hibernate.org

Thank you for that link. That helped explain the proxy attribute. I have another question related to Hibernate.initialize() in Section 19.1.4. In a 3-tier application, we usually run into LazyInitializationException because of closed sessions. This section mentions the use of Hibernate.initialize() to initialize collections. What does initialize actually mean on a collection. Does it mean that suppose i invoke Hibernate.initialize(children), then ...

65. Problem deleting collection element with null attribute    forum.hibernate.org

Using the slightly modified version of example from HibernateAnnotations test code, I have an entity Boy that has a CollectionOfElements of Toy (that has 2 simple string attributes). The test case is as follows: (1) I persist a Boy entiry with a collection of 2 Toy elements. One of the elements has a null value for "brand" attribute. (2) I load ...

66. mapping many-to-many with extra attribute in mapping table    forum.hibernate.org

I have a simple many-to-many user-company relationship, but I also need to store an extra attribute at the companyUser level. Can I put the extra attribute in the many-to-many companyUser mapping table and still get access to it? I have tried modelling the relationship as two relationships - many-to-one, one-to-many, and then managing the mapping table manually. But doing that seems ...

67. Read only attributes    forum.hibernate.org

Is there any way to designate in the configuration that once an attribute has been set on a POJO in the database, that it cannot be changed? For example if I have a User object and it has a ID of 1 and a UserId of "testuser" that once UserId is set to "testuser" it cannot be changed.

68. Updated record after an attribute modification    forum.hibernate.org

Howdy, I am using Hibernate 2.1.8 within weblo. I have an object A having a "set" relation with an object B. I noticed that when I change only one attribute from my object B, hibernate updates all the attributes of B and not only the one that have been changed. I am wondering if there is a way to oblige hibernate ...

69. Null BIT column mapped to a boolean attribute    forum.hibernate.org

Hibernate version: 3.1.2 Code between sessionFactory.openSession() and session.close(): Session management carried out by Spring Framework Full stack trace of any exception that occurs: 09:47:39 ERROR [org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:412)] Could not complete request org.apache.jasper.JasperException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) sett er of com.shawmut.model.project.bid.BidInvitation.setBidSubmitted at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) Name and version of the database you are using: ...

70. Named SQL Query - return-scalar attribute    forum.hibernate.org

Hello, I was trying my hand on the Named Queries for SQL feature of Hibernate. I wrote a SQL query like select newsletter.name, article.title, author.name from Newsletter newsletter, Article article, Author author, newsletter_to_article, Author_to_article where article.id = newsletter_to_article.article_id and newsletter.id = newsletter_to_article.newsletter_id and author.id = author_to_article.author_id and article.id = author_to_article.article_id where you would notice that the newsletter and author table have ...

72. How use lazy attribute for many-to-one in hibernate3.x?    forum.hibernate.org

Hi there, Tow classes C and P and the relation between C and P is many-to-one,the source code as follows: public class P{ private Long pid; private String name; private Set cset=new HashSet(); public Long getPid(){ return pid; } public void setPid(Long pid){ this.pid=pid; } public String getName(){ return name; } public void setName(String name){ this.name=name; } public Set getCset(){ return ...

74. Runtime change attribute length    forum.hibernate.org

Hi I intially created class 'Emp' withString type attribute(address) with length 20; Using DDL2hbm i cretaed tables in MSSQL DB; After that i inserted 20 char string for address field. Then i changed to address field length 20 to 15;Then again i updated ddl2hbm. But my DB Emp table address field pointing varchar 20,which i was intially created. But i want ...

75. Property mapping with unique attribute    forum.hibernate.org

76. The Formula Attribute is not being executed at all.    forum.hibernate.org

Hi All, I was writing an xml for using the formula attribute in the property tag. I want to query a table and set the returned value for a property. The XML that i wrote is given below. Can anyone tell me why the SQL query is not being executed at all. Is there any other settings to be done. The ...

77. Getting Multi-valued Attributes in HQL select clause    forum.hibernate.org

Hibernate version: 3.1.1 Hi All, A little background I am developing a query service based on HQL for my DataBase (DB Contains Identity Information). This service will be used for only data retrieval by many other systems. My DB structure is as follows Entity A Single valued Attributes : name, description, status Multi valued attributes : alternate names, group codes We ...

78. Criteria that restrict a map attribute, is that possible?    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.0 Mapping documents: . . .