Runtime 1 « Core « JPA Q&A





1. NHibernate: accessing configuration properties (Sql dialect) at runtime    stackoverflow.com

I would like to retrieve at runtime the values for the "dialect" and "connection.driver_class" properties specified in the configuration file. Do you know how to do that? Many thanks, Nicola

2. JPA cascade options at runtime    stackoverflow.com

I'm trying to make an application that keeps an object model in sync with a database by observing all changes and then immediately persisting the objects in questions. Many of ...

3. How can I change annotations/Hibernate validation rules at runtime?    stackoverflow.com

If have a Java class with some fields I want to validate using Hibernate Validator. Now I want my users to be able to configure at runtime which validations take place. For example:

public ...

4. JPA: How do I specify the table name corresponding to a class at runtime?    stackoverflow.com

(note: I'm quite familiar with Java, but not with Hibernate or JPA - yet :) ) I want to write an application which talks to a DB2/400 database through JPA and ...

5. how do I change persistence.xml at run time    stackoverflow.com

I am new to openJPA. I have a scenario where, depending upon the server where my application is running, I need to change the settings to persistance.xml. For eg. if its running ...

6. Dynamically create table and java classes at runtime    stackoverflow.com

I have a requirement in my application. My tables wont be defined beforehand.For Example,if the user creates a form by name Student,and adds its attributes like name,roll no,subject,class etc.. then ...

7. Hibernate configuration on runtime    stackoverflow.com

I have hibernate.cfg.xml file.

<session-factory>

    <!-- Database connection settings -->
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="connection.url"></property>
    <property name="connection.username"></property>
    <property ...

8. Nhibernate - How to debug "Antlr.Runtime.NoViableAltException"?    stackoverflow.com

With many HQL queries I am trying, time and time again I am getting this exception:

Antlr.Runtime.NoViableAltException
This is really generic and unhelpful - does anyone know how best to debug this? ...

9. Annotations present at compile time but absent at runtime    stackoverflow.com

It is possible to use Java class files which includes annotations that are not present at runtime? Example: I want to write a class with the JPA @Embeddable annotation, which would be ...





10. Can I use JPA/EJB3 on a table that was created at runtime?    stackoverflow.com

This is weird and probably not possible but I'll ask anyway. I'm making this app that reads in a meta file and creates some tables then populates them with data. ...

11. how openjpa2.0 enhances entities at runtime?    stackoverflow.com

Below is my test code:

package jee.jpa2;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.persistence.Query;

import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Test
public class Tester {
    EntityManager em;
    EntityTransaction tx;
    EntityManagerFactory ...

12. Dynamicly select datasource for entities runtime    stackoverflow.com

I have an entity bean that will represent an expected result over multiple databases/datasources and can also be different queries executed, but same result always comming back. So the bean is ...

13. How to catch a runtime exception in a NB platform module?    stackoverflow.com

As described here, I want to update the user's database by means of catching the exception that occurs when the entity classes don't match. I understand that I ...

14. JPA - Change table at runtime    stackoverflow.com

Tables
sales_2009
sales_2008
sales_2007
And only one class (sales), How change the table at runtime?

15. How to create valid Domain objects at runtime in Grails    stackoverflow.com

I have a few domain classes, and I want to be able to populate a new Domain class and persist it to the database via one of my controllers. Here are ...

16. Change Table Name of an Entity on runtime?    stackoverflow.com

There is this is this table that is being generated on a monthly basis. Basically the table structure of all monthly tables is the same. Since it would be a lot of ...





17. Any way to inject/choose datasource at runtime?    stackoverflow.com

I have a MySQL database with many databases, each named for a specific customer. A webapp is deployed per customer. The name of the webapp determines the underlying database name. When the ...

18. Hibernate c3p0 config parameters not getting affected at runtime    stackoverflow.com

I am using c3p0-0.9.1.2.jar and hibernate 3.2.1. Following are the hibernate config.

    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/oDB</property>
    <property name="hibernate.connection.username">oDBUser</property>
   ...

19. Hibernate database password at runtime    stackoverflow.com

Is there a way to ask for the database password at runtime instead of putting it (encrypted or not) in the hibernate.cfg.xml file?

20. Getting hibernate information about entites at runtime    stackoverflow.com

I am seeking a way to get information about my hibernate entity classes at runtime. In detail I would need information like

Class ABC has the properties a, b ...

21. how to change hibernate connection at runtime in java?    stackoverflow.com

i found this solution but its not working, im using netbeans my hibernate.cfg.xml:

<hibernate-configuration>
    <session-factory>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
      ...

22. Hibernate - how to reflect changes in database at runtime?    stackoverflow.com

I have an application full of real data. I'd like to provide aministrator interface, who can add new columns, indexes and so on to database tables. But of course there are ...

23. Is it possible to have a grails app choose between hibernate and mongodb at runtime    stackoverflow.com

I'm trying to build a Grails App. I want the user who installs this grails app on their tomcat instance be able to choose whether they want to use hibernate with ...

24. Hibernate = Setting Cascade options at runtime?    stackoverflow.com

The Hibernate Doc state:

"Finally, note that cascading of operations can be applied to an object graph at call time or at flush time. "
Source: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/objectstate.html Where ...

25. Changing Hibernate SQL logging level in Logback at runtime through JMX    stackoverflow.com

I have configured Hibernate to use logback logging library. And created an appender that catches logging data from "org.hibernate.SQL" and "org.hibernate.type" loggers. By default, those are set to INFO level. As ...

26. Hibernate Criteria runtime class    stackoverflow.com

This is my hierarchy:

// Table a
class A {}

// Table(" b
class B extends A {}

// Table my_class
class MyClass {

    A a;
}
I want to retrieve all MyClass objects from database ...

27. Is there any way to find out (at runtime) which entity has caused a ConstraintViolationException?    stackoverflow.com

I have a (REST) application that handles CRUD operations initiated by a 3rd party, and basically my problem is in returning an easily understood error message in the case of a ...

28. JPA - change database URL at runtime    forums.netbeans.org

Hi everybody, I'd like to know if it's possible to change database url at runtime using Toplink Essentials as persistence provider. Thank you very much in advance for your help

29. [platform-dev] Modifying XML at runtime before JPA kicks in    forums.netbeans.org

Posted: Thu May 27, 2010 9:17 pm Post subject: [platform-dev] Modifying XML at runtime before JPA kicks in I was pondering on how I should go about modifying ...

30. reading DB at runtime (hibernate)    coderanch.com

31. set lazy to false in runtime in Hibernate    coderanch.com

Hi all I have two table one is master and other is detail and a class that contains a list refer to detail. class Master { .... private List details; } I set lazy to true in one-to-many relation (lazy="true") so when I going to load details ( master.getDetails(); ) an exception occures. I want to know, is there any way ...

32. Hibernate - Getting the table name at runtime    coderanch.com

I have recently written a custom primary key generator implementation. The implementation requires that you provide a context for a new key request. For example, if I want to get a new key for an insert into a table called Contacts, my context is Contacts. I would like for my key generator implementation to be able to determine at runtime what ...

34. Runtime Error when using Annotation on property in JPA    coderanch.com

Hi, When making an Entity in JPA I have to put the Annotations on the getter-methods to get the application working. When I try to move any Annotation from the getter-method to the corresponding property I always get a runtimeError. Are there any restrictions when to put the Annotation directly on the property? Anyone else experienced this? This works fine: public ...

38. runtime exception getting when i execute hibernate program    coderanch.com

even though i made it as hibernate.dialect same error i am getting... both xml files also i placed in the same folder as the program resides. but still getting the same error. i am running this program in eclipse. i think may be problem will be in classpath. will you please tell me what are the all jars i should place ...

39. JPAQueryBuilder: Building JPA query in runtime    java.net

Hi there, I would like to know what do you think about the library I wrote and use at work for many months now. In my company, we use it quite often as it makes lot of things easier. The only bad thing is that current JPA spec. does not provide a possibility to compile such a query once by database ...

40. class not found runtime exception with jersey, ejb, and jpa java project    java.net

I am running glassfish v3 inside eclipse with a deployed ear composed of a war, an ejb jar, and a jar from a java project that i am using to house my jpa entities. For some reason, even though the jpa java project is on the class path of both the ejb project and the web project (Jersey), hence it compiles, ...

41. Need help with a runtime error using Hibernate in a Java app    forum.hibernate.org

Author Message syedfa Post subject: Need help with a runtime error using Hibernate in a Java app Posted: Thu Dec 17, 2009 1:13 am Newbie Joined: Thu Dec 17, 2009 1:07 am Posts: 1 Dear fellow Java developers: I am getting a runtime error when I try to run my java application that uses hibernate. The error message I'm ...

42. Hibernate subselect with runtime parameters ?    forum.hibernate.org

select item.name, item.x, item.y from item where item.x > :x join bid on bid.item_id = item.id group by item.name ...

43. Determine database name at runtime    forum.hibernate.org

44. How to Database connection string in runtime    forum.hibernate.org

45. Hibernate query changed in runtime    forum.hibernate.org

46. hibernate formula with run time parameters    forum.hibernate.org

Hello, I was hoping for a suggestions on how best to tackle this issue. I am trying to build a simple store. The trouble i am having with is item pricing and availability. The items availability and pricing is based on the user. There are scenarios that a product might not be available to a guest but is available to a ...

47. Set Table at Runtime    forum.hibernate.org

Hello, this is my first project using Hibernate so I have very little experience but also haven't found the solution to this on Google, I see a lot of posts asking this same question, but never any clear answers on what the solution is so I figured it's time to ask the pros. Essentially my problem is I have 1 database ...

48. How to discover the persistent obj id attr. name at runtime?    forum.hibernate.org

Hi! I'm implementing a generic DAO object to execute CRUD operations on objects whose classes have been mapped on Hibernate. I'm using JPA annotations for the class mapping. In order to construct some filter expressions used internally, this DAO object needs to obtain the name of the attribute that has been mapped as the object's id for a given persistent object. ...

49. Annotations change at run time    forum.hibernate.org

50. change parameter in configuration file at runtime    forum.hibernate.org

Dear all, I've a question for you. I'm using hibernate with derby db in my java application. I want to develop this requirement. In my application I need a button "Create new archive". Clicking on it I'd like a new derby archive is created and configuration file should point to this after reboot...that is what I need is create new archive ...

51. Change Named Queries in Runtime    forum.hibernate.org

52. Create Table / Alter Table on Runtime    forum.hibernate.org

Hi, I am quite new in using Hibernate, but unfortunately I am required to perform a quite challenging task. Our Document Management application would like to have a capability to create / alter some profile tables on runtime. The idea is different departments' users may have to enter different information when they upload the documents. I understand that this could be ...

54. Discovering Named Queries at runtime    forum.hibernate.org

Is it possible to determine what named queries exist at runtime? We have a series of database updates we do via named queries basically stored procedures we call that have predefined names. We've run into a constraint that it looks like you can only have one stored procedure per named query. Ideally we could have more then one stored procedure per ...

55. Modify Configuration Object at runtime    forum.hibernate.org

56. Hibernate classpath issue: Run time error    forum.hibernate.org

I am using eclipse-helios to learn and try out some hibernate tutorials . I am having issue of " classes not found errors " during run time of my code on all these jars listed below even though the User Library I have created has all these jars in it. Here is my set up. I have created a User Library ...

57. Lazy at runtime ?    forum.hibernate.org

58. database qualification at runtime?    forum.hibernate.org

We need to run joins across schemas (some refer to as the database qualifier) which isn't likely much of an issue for Hibernate: SELECT c.city_name, c.population, b.business_name FROM myDB.up_city c LEFT OUTER JOIN yourDB.up_business b ON c.city_name = b.city_name; The issue is that we don't know the actual values for the different schema qualifiers (myDB and yourDB in the snippet) until ...

59. Is it possible to set lazy at runtime?    forum.hibernate.org

I want a java method to consult a classe Xpto that has a some Set's. All these Set's are loaded lazy by default. The method returns a Xpto instance. But the client can't view one of Xpto's Set's because there loaded lazy and I've already maid the session.close() in the method, giving the "LazyInitializationException". Is there a way to set lazy="false" ...

60. Runtime Error Question    forum.hibernate.org

I receive a runtime error during the initial setup of the persisting objects to my oracle database. These include: 16:53:38,992 WARN SessionFactoryImpl:262 - Problem opening output stylesheet - databinding disabled javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.tran\ sform.TransformerException: Did not find the stylesheet root! at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:946) at net.sf.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:259) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:618) Yet I do not have any stylesheets in use. I can persist my data just ...

61. Set Logging Level at Runtime    forum.hibernate.org

62. Can you access contents at runtime?    forum.hibernate.org

I'd like to pass some configuration data from the mapping file to a custom user type (an implementation of CompositeUserType). The dtd has provisions for tags to carry extra information, but I can't access the meta data at runtime. I traced through the code to find that all this meta info is discarded after Hibernate finishes configuring itself from the ...

63. adding new persistable classes at runtime    forum.hibernate.org

Newbie Joined: Thu Feb 26, 2004 11:42 am Posts: 2 Hi. Please excuse my english. This question seems to have no answer in forums nor wiki: * We currently have a product (not Hibernate based) which manages inventory. We do it by modeling "inventory items" in an OO way: we have 'item classes' which define what attributes an item must have ...

64. How to determine Hibernate type at runtime    forum.hibernate.org

I am trying to write an accessor class for Hibernate using Java Generics. What I would like to write is something like this: List dataList = (List) session.find( "from " + this.classObj.getName() + " as objclass where objclass." + this.realKeyName + " = ?", key, Hibernate.entity(key)); But Hibernate.entity doesn't work for simple key types like String, so instead I have to ...

65. runtime lazy initialization    forum.hibernate.org

66. build new SessionFactory at runtime for datasource    forum.hibernate.org

I saw it was said that we can build new sessionfactory instance at runtime for different datasource. This is very interesting to me. I could use code like: SessionFactory newSessionFactory = config.buildSessionFactory(); where config is a Configuration object. My trouble is that I need to clone the Configuration object of the existing session factory. The only thing I need to change ...

67. Lazy or Non-Lazy at Runtime    forum.hibernate.org

I'm not sure if I understood the lazy thing in hibernate. My idea is like this that i can find my orders from primary Table and send it to the view in a searchresult List. The user decides which order he want's to see. At this time I want to load the whole order with it's childrens. For example a SupplierId. ...

68. Will Hibernate support add/drop columns/tables in runtime?    forum.hibernate.org

Hi, I'm developing an application that allows the end-user to modify the database schema in runtime. The user can add or drop columns or tables... I was considering Hibernate 2.1 as the persistence layer, but I can't use it for my purpose. However, someone told me that Hibernate 2.2 will support this. Is this true? (How can I do it? Can ...

69. Sorting a set at runtime    forum.hibernate.org

How can I sort a collection mapped as a set at runtime? I've tried session.filter(node.getNodes(), "ORDER BY name ASC"); but it seems like it returns a new collection instead of sorting the collection itself. When Hibernate lazy loads the node.getNodes() in the view it is still unordered. I can implement a Comparator but would like to sort the collection in SQL. ...

70. change properties on runtime    forum.hibernate.org

71. working with metadata at runtime    forum.hibernate.org

72. cretaing and droping tables at runtime    forum.hibernate.org

73. Runtime Lazy Initialization question    forum.hibernate.org

74. Getting second level cache info at runtime    forum.hibernate.org

75. java.lang.ArrayIndexOutOfBoundsException Occured in Runtime    forum.hibernate.org

When I do the simple search from database, the java.lang.ArrayIndexOutOfBoundsException was Occured in Runtime. public List findUncompletedGroups() throws LevelException{ List groupsIsUnCompleted; try{ Session session = HibernateUtil.currentSession(); groupsIsUnCompleted = session.find("from Groups where TimeCompleted like '1970%' and levelID = ?", new Long(levelID), Hibernate.LONG); }catch(Exception e){ throw new LevelException("Error in Level.findUncompletedGroups()" + e, e); } if(groupsIsUnCompleted == null){ throw new LevelException("Error in Level.findUncompletedGroups() groupsIsUnCompleted ...

76. Runtime specification of cascading action    forum.hibernate.org

77. Manipulating Metadata at runtime    forum.hibernate.org

Hibernate allows you to manipulate the metadata structure at runtime via the classes defined in package org.hibernate.mapping. However the javadoc for these classes is, at best, slim! Is there any example code for this? In particular, is there an example that uses dynamic components and classes? The only example I have found is a brief note in Hibernate in Action. Thanks ...

78. create tables on the fly (runtime)    forum.hibernate.org

hi, newbie here - just in case i ask stupid question. thing is, I want to use HIbernate in my web app. I was able to write models (POJO) and persist them to the DB. But my app requires creating tables "on the fly" based on the user input at the web front end. These tables are based on one model ...

79. How to set fetch at runtime for createQuery    forum.hibernate.org

Iam using Hibernate version 2.0 and would like to know how can i set fetch option at runtime.I dont want to use createCriteria as i will not be able to use projection. my function looks like following public ArrayList getActivatedAddendumFixedPricing(String addendumVersion,int startIndex,int numberOfResults,String mode) throws HibernateException { StringBuffer sb = new StringBuffer(); List objects = null; ArrayList activatedAddendumFixedPrice = new ArrayList(); ...

80. Manipulating Metadata at Runtime    forum.hibernate.org

Hi folks, I hope somebody can help me with this. Basically, I have a user requirement that they be able to "add" fields to my objects after the product ships. Historically I've solved this problem with metadata driven systems where the user could just modify the metadata and their meta-object would change. Recently though I've fallen in love with hibernate (it ...

81. Changing table names at runtime    forum.hibernate.org

We are looking for more ideas (using Hibernate 3 and Oracle) to point the same Hibernate persistent class at different copies of the same table at runtime depending on a context set within the application (new tables/contexts are dynamically configured for the application). We are considering one alternative of dynamically loading new configuration/session factories (with selected class definitions and context-specific table ...

82. Can I set lazy value at runtime?    forum.hibernate.org

Hi, Is it possbile to set lazy value at runtime? For certain session? Most of the time I don't need whole object graph to be initialized, but in some occasions I do, so I need to change it at runtime. I cannot use join fetch feature, because there is kind of subassociation A contains set of B classes, B containss set ...

83. Objects corrupted at runtime with Hibernate 3    forum.hibernate.org

84. Runtime error in Hibernate 3.0.3 tutorial    forum.hibernate.org

Newbie Joined: Thu May 19, 2005 12:49 am Posts: 4 G'Day all, I have been trying to run the tutorial in Chapter 2 of the Hibernate reference that ships with Hibernate. When I run the tutorial, I get the following output bash-2.05b$ ant run -Daction=store Buildfile: build.xml clean: [delete] Deleting directory /home/craig/workspace/HibernateTutorial/bin [mkdir] Created dir: /home/craig/workspace/HibernateTutorial/bin copy-resources: [copy] Copying 6 files ...

85. Managing the Cache at runtime    forum.hibernate.org

Hibernate version:2.1.8 EHCache version: 1.1 We have setup the hibernate mapping files to cache the data and relationships. Everything seems to be working as expected. Is there any way to change the setting at runtime. I would like to be able to turn the caching off and on at runtime. some times we have lot of database updates directly through pl/sql ...

86. Runtime modifications to DDL - best practices    forum.hibernate.org

I'm thinking about using Hibernate in an application that involves frequent user-driven modifications to the database schema. For example, the user will be performing actions that often result in table creations or table modifications. I'm wondering about the best way to handle this. Is the normal way to do this to programatically update the hbm files, then run schema update or ...

87. Subselects: How to avoid HSQL-String-creating during runtime    forum.hibernate.org

Hi folks, just a question: There are 2 entities: Employee and Qualification (Association: one to many). One Qualification represents a composite of one skill and one level/rating. Now I like to query over all employees to get employees, which match to a list of qualifications. I think the approach is in HSQL: e.g.: I like to get all employees which match ...

88. Modify at runtime    forum.hibernate.org

89. [Hibernate 3] Accessing class metadata at runtime    forum.hibernate.org

We're using Hibernate 3.0.5 on our project and to meet one of the requirements I need to be able to read (and just read) some class mapping metadata. Specifically, I need to get able to determine the schema, table, and column names for a field within a class. I've spent some time looking, searching the forums (I might have just missed ...

90. How do I set cascade styles at runtime?    forum.hibernate.org

I was wondering if there was any concrete examples of a solution to this issue [RE: set cascade art run time] The Reference doc does make this reference [Chapter 4 Persistent Classes: Section 4.4 LifeCycle Callbacks]: onSave(), onDelete() and onUpdate() may be used to cascade saves and deletions of dependent objects. This is an alternative to declaring cascaded operations in the ...

91. Is possible add columns to a table at run time?    forum.hibernate.org

Hi all, First sorry, my english isn't good! :S I need add columns to tables at runtime. The user at any time can be create new columns in a table. How I can make this? Is it possible? I try find some example or documents, but I dont get any sucess. Maybe, I dont make the right question on the google! ...

93. properties tag constituents - runtime inference, how?    forum.hibernate.org

org.hibernate.mapping.PersistentClass pc = cfg.getClassMapping( SomeDomainObject.class.getName( ) ); org.hibernate.mapping.Property id = pc.getIdentifierProperty( ); String idPropertyName = id.getName( ); java.util.Iterator idColIter = id.getColumnIterator( ); while( idColIter.hasNext( ) ) { org.hibernate.mapping.Column idCol = (Column)idColIter.next( ); String name = idCol.getName( ); ... } java.util.Iterator subclassIter = pc.getSubclassIterator( ); while( subclassIter.hasNext( ) ) { ...

94. Runtime ordering of named query results    forum.hibernate.org

Greetings. I need to be able to change the ordering of the result returned by a named query at rutime. Initially I was trying to createFilter on the collection returned by the query, but that didn't work because collection was not persistent and Hibernate was throwing an exception. I would like to avoid creating similar HQL queries with different ORDER BY ...

95. changing hibernate shemas at runtime    forum.hibernate.org

In our environment, we have three logical schemas in one database. Since all of these schemas are accessed from the same session factory and data source, we need to include the schema attribute in our hibernate mapping files. We would like to be able to create new sandbox environments by just adding new schemas in the same database. The problem, however, ...

96. apache.jasper.runtime.PageContextImpl.doHandlePageException    forum.hibernate.org

I'm using Hibernate Tools, so i try to connect to the database through the console configuration, like i used to prior to reverse engineering, and for my surprise, it doesn't let me, saying there's a mapping file missing... But guess what... the file is there where it's supposed to be. Hibernate or Hibernate Tools must have messed up with my classpath, ...

97. Setting the FetchMode at Runtime    forum.hibernate.org

[b]Hibernate version: 2.1.7 I have defined a relationship between a "Batch" object and a collection of "Batch Records" with lazy loading turned off i.e. lazy="false". In most cases, when I retrieve a Batch, I want to retrieve all the Batch Records associated with that Batch so having turned off is working out good. There is however one case where I want ...

98. Runtime parameters in derived property formula    forum.hibernate.org

Piper did you get an answer to your question? It looks like we're doing the same thing, here's the HQL I use but I need to get the actual distance as well. I don't see how formulas will help me here: String hql = "from Business biz where biz.name like :criteria and "+ " acos( " + " sin(:lat) * sin(biz.address.latitude) ...

99. Create tables at runtime    forum.hibernate.org

I want to write a web application in which part of the database schema is stable (i.e. will not change after the application has started) and part of the schema is dynamic (i.e. at runtime it is possible for users to create , alter and drop tables). I was wondering if it is possible to use Hibernate for this. I read ...

100. Creating tables dynamically on runtime    forum.hibernate.org

Hi all, I'm a newbie in Hibernate, and i met with a problem that i can't solve. I have to generate a table during runtime with hibernate. Is it possible, and does Hibernate support that? First step seems to be modifying hibernate.cfg.xml, adding a new line of , representing the class that I want to make the table of. Does ...