Runtime 2 « Core « JPA Q&A





1. how to dynamically configure a SessionFactory at runtime    forum.hibernate.org

I have a helper class that uses the ThreadLocal Session pattern to generate the SessionFactory. However, I need to dynamically configure the mySQL database that hibernate connects to so the SessionFactory in my helper class isn't declared static. Instead I instantiate a HibernateHelper object in my main app, passing the database name to connect to. I'm curious if this is an ...

2. How to modify a named query at runtime?    forum.hibernate.org

Hi, I have looked around trying to find how to modify in runtime a query that I use in an hbm.xml file. I need to change it because the query must adapt to the user's requests, e.g: to change the sort order of the query or to modify the where clause conditions. It is quite impractical to simply add new querys ...

3. Runtime Parameter replacement failing    forum.hibernate.org

I'm using Hibernate 3 and am having a strange issue with querying one of my persistant objects. The problem is that when I use parameter replacement the query returns no results "select prod from ProductImpl as prod where prod.myfield=?", productId If I replace this with the following I get the expected results "select prod from ProductImpl as prod where prod.myfield='"+productId+"'" I ...

4. Restricting access to specific objects at runtime    forum.hibernate.org

We still have the same problem of maintaining two or more separate config files. I agree these are solutions that work, but I am looking for a more maintainable solution. Something that maybe Hibernate doesn't do at the moment, I don't know. From a code standpoint, I should be able to specify what objects cannot be accessed in any given JVM. ...

5. Runtime configuration    forum.hibernate.org

6. how to turn off the hibernate logging at runtime?    forum.hibernate.org

since i m using the hibernate in our application there are so many debug statements comes in application console. such as all sql dml statements. now i want to turn on and off the logging at runtime through a button on jsp. so how to do this please suggest me. thanks in advance.

7. how does hibernate use runtime reflection ???    forum.hibernate.org

8. Replace runtime instrum. completely with build time instrum.    forum.hibernate.org

Hallo, we use for Hibernate the Build-Time-Instrumentation because we use field access. I do not understand why runtime instrumentation is used either we instrumented in the build time. Is there a possibility to prevent runtime instrumentation and do all instrumentation in the build time? We have over 200 persistent classes and runtime instrumentation takes much time. Ciao Peter Schtt P.S. Sorry ...

9. How to add dynamic (runtime) order clause for collection?    forum.hibernate.org

Hi, I need to write code that would allow for dynamic specification of order-by column for a collection of children of the main object. I tried to add order to criteria object by using the collection alias: String alias="parent.children."; Criteria.addOrder(Order.asc(alias+"childColumn")); But that did not sort the children inside the collection at all. I found out that I could modify the mapping ...





10. How to set a class do use Dynamic Insert/Update at runtime?    forum.hibernate.org

I want to be able to switch between using/not using dynamic inserts at runtime, and I wonder how I can do it? I noticed a class org.hibernate.mapping.PersistentClass that has a method setDynamicInsert(boolean dynamicInsert) which is just about what I want, but I can't seem to find any way to use it... Thanks in advance for any help :)

11. Change connection, database name at runtime?    forum.hibernate.org

12. Can you change cascading relationships at runtime?    forum.hibernate.org

I know there is a way to load relationships early at runtime, and hibernate suggests we mark all relationships as lazy then eagerly load then at runtime. It seems the same might apply to cascade relationships. However, I have not found any mention of this in the docs. Is there a way to change cascading relationships at runtime? Thanks Charlie

13. Can i pass hibernate.properties in runtime?    forum.hibernate.org

14. Runtime persistent class creation.    forum.hibernate.org

15. log runtime exception in CacheSynchronization    forum.hibernate.org

16. how to change used database at runtime    forum.hibernate.org

Hi, you can set a new hibernate.cfg.xml File with this Method in the HibernateSessionFactory.java /** * return session factory * * session factory will be rebuilded in the next call */ public static void setConfigFile(String configFile) { HibernateSessionFactory.configFile = configFile; sessionFactory = null; } The Parameter is the Path to the Configurationfile e.g.: "/path/to/hibernate/NEWhibernate.cfg.xml" After this, you have a new session, ...





17. get generated sql at runtime    forum.hibernate.org

18. Help with getting associations at runtime    forum.hibernate.org

Hibernate version: 3.0.2 Hello! I am using Criteria to allow users in my App to query almost anything in the Db, but I have one problem when I have to go for a deep join I have to create the table graoh in order to navigate the table structure. In my graph each node is an entity mapped to hibernate involved ...

19. Change Hibernate Configuration at Run Time    forum.hibernate.org

Hi I want to create an application using Hibernate but dont know what database the end user might use. Therefore I want to let the user edit the Config file based on his database choice and deploy it. All I want to provide is a war file for the application. Could someone pls explain how it would all work - where ...

21. How to add property runtime to entities ? help me    forum.hibernate.org

Hi we have a requirement where user can add columns runtime and there after data will come to DB. User should also be able to use those columnes for execute query. We want to use hibernate. Can any body help me out, how to add properties runtime to the entites and how to do the mappings at runtime.

22. How to change database at runtime?    forum.hibernate.org

Hi friends, As a part of an application , I am checking the username and password for a particular user in cenral database, i am using this database configuration in hibernate.cfg.xml file. once the user is authenticated all his further data is stored in his seperate database (not tables) whose database name is stored in central database along with his username ...

23. How do I manuplate the named query at run time?    forum.hibernate.org

I am using EJB 3.0 entity beans and I have a specific requirement. I need to modify the named query at the run time like add some extra search criteria just before the actual execution. This needs to be done at the framework lavel so that developer do not care about it. Can any body help? Thanks in advance

24. How to create & enable global filter at runtime?    forum.hibernate.org

25. performance issues are cropping up during runtime    forum.hibernate.org

Hi 1)Bags have been used for child table mapping, in bag mapping ids do not get generated. So performance issues are cropping up during runtime with huge data. What are the other options to change this without much code change 2)If application is distributed, transaction exceptions are not communicated to the client. how can it be possible to communicate it to ...

26. Accessing info about XML / DOM4J node names at runtime    forum.hibernate.org

Hi, I'm searching for a possibility to find out the (XML)-node-names of properties at runtime. So if I have mapped a class e.g. with the following mapping: Code: ...

28. Creation of Tables in MS SQL at Runtime    forum.hibernate.org

Hi! I wanted to know if I can create a table at runtime using Hibernate? My project has spec wherein I need to create a table based on a particular creteria. My system will be providing the fields for the table. I'll be using JBoss server. As far as I know, when you fire a query using Hibernate, the hbm.xml files ...

29. lazy collection fetching at runtime    forum.hibernate.org

Hi @all I have a special requirment for fetching collections lazy at runtime. Situation: A Class: CodeTypes has zero or n Classes: CodeValues. As default in the mapping file, of CodeType, the lazy attribute is "false" on the set (see below). Now i have a special case: how i can load a CodeType at Runtime without loading all his CodeValues. Is ...

30. Getting the DriverManagerConnectionProvider at Runtime    forum.hibernate.org

I'd like to build a simple demonstration of manipulating the hibernates connection configuration at runtime. My application includes my own implementation of a DriverManagerConnectionProvider and it works and does everything I need. Question: how can I get ahold of the live DriverManagerConnectionProvider instance from my Java application at runtime so I can call attribute set methods and ask it reconnect and ...

32. Criteria: Get executed SQL at runtime    forum.hibernate.org

33. Is possible to put metadata onfly (runtime)    forum.hibernate.org

I saw a example at Java Persistence with Hibernate where there is a PersistenceClass to get configuration form some persist class, that example was used to show how to configure runtime configuration for some fields typed. But that class works with Session context, without EJB3.0. I need some sample that show some similar class working with EJB3.0. There is another similar ...

34. Manipulating metadata at runtime. Something wrong?    forum.hibernate.org

Hibernate version: 3.2 Mapping documents: Code: ...

35. Runtime Filters    forum.hibernate.org

36. can hibernate create table at runtime    forum.hibernate.org

hi, I have been wondering about this for a while now. basicly i wanna to have a dynamic website which hands everything to the front view including create of a table in database. i know without Hibernate and Spring it is possible but it's a lot of work. i have been searching for resources in everything way but no Luck. please ...

37. How to change the lazy option at runtime?    forum.hibernate.org

Hello, Actually I have a graph of objects connected to each other; all of the relations are none lazy since this is the default behavior of our business (we are almost navigating the relations). But for some rare cases & due to the performance issues, I need only one relation to be none lazy & I dont care with the others ...

38. Hibernate runtime configuration    forum.hibernate.org

Hi, I'm using Hibernate 3.2.3 wich ehcache 1.2.3 and have following idea: I want to switch the cache on/off at runtime. If don't enable caching in the hibernate config, "cache" mapping tags in the bean configuration produce an "NoCachingEnabledException: Second-level cache is not enabled for usage" exception. Is there a way to avoid this exception? Second question: is it possible to ...

39. Order by ntext sql server(HQL on runtime to Sort)    forum.hibernate.org

Hi, I am using Hibernate 3 with SQL Server 2000. On one of the screens in my application, the User can sort by clicking on any of the column headers on the displayed table. One of the columns is of the type "ntext" in the database. I am appending and forming the HQL on runtime based on the User input to ...

40. Create Database at Runtime?    forum.hibernate.org

Hi Guys, I am wanting to create a database at startup (if it is not already present). The url information in my configuration file (hbm.xml) seems seems to be the url for connecting to a Database (which of course if NOT created yet). Is there a way to do this? It seems like I have to connect to the DB Server ...

41. Setting JDBC url and credentials dynamically at runtime    forum.hibernate.org

Hibernate version: 3.2 Name and version of the database you are using: DB2 8 Pardon my newbieness! I'm working with 3.2 Core (no annotations), using mappings, DOA's, and a session factory automatically generated by MyEclipse 6.5. I'm trying to build a internal web app for maintaining some small sets of data. The kink is that this admin tool can be pointed ...

42. Changing Collections Cascade behavior at runtime    forum.hibernate.org

43. Changing Collections Cascade behavior at runtime    forum.hibernate.org

Hello, I am using Hibernate 3.2 and I was hoping to be able to change the cascading behavior of a one to many relationship at runtime rather than having to lock-in the behavior at build time. Depending on what is happening in my application, I would like to programatically select Cascade persist, merge, and save-update at certain times but I don't ...

44. Access Configuration Object Runtime    forum.hibernate.org

I need to get access to the Configuration object of hibernate to get the list of PersistentClasses at run time. Is there anyway to do it? Basically, I start my J2EE application with persistence.xml in JBoss. Hibernate automatically loads up my persistence unit and binds the entity manager and session factory to JNDI. I have a audit service which I can ...

45. run time exception classnot found exception due to cglib    forum.hibernate.org

i am newbee at hibernate i tried to execute a program using hibernate the code to get an hibernate session is like this SessionFactory factory = new Configuration().configure().buildSessionFactory(); Session session = factory.openSession(); session.beginTransaction(); Message m1 = new Message( "Hibernated a message on " + new Date()); session.save(m1); session.getTransaction().commit(); session.close(); the exception is given below Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/cglib/proxy/Callbac at ...

48. Problem getting ImprovedNamingStrategy to work at run time    forum.hibernate.org

Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message andrewclegg Post subject: Problem getting ImprovedNamingStrategy to work at run time Posted: Wed Dec 03, 2008 1:31 pm Newbie Joined: Mon Nov 24, 2008 8:27 am Posts: 7 Hi, I'm trying to get naming strategies to ...

49. Retrieving the configured Dialect at runtime.    forum.hibernate.org

Hi. What's the proper way to retrieve the Dialect at runtime. The main idea is that I want to get the next value for a database sequence by creating a query independent of the Dialect used. For this I need the Dialect so that I can call getSequenceNextValString() on it. I first tried to get the dialect from the Environment's properties ...

50. how create the table in runtime in hibernate    forum.hibernate.org

51. Can we change connection string during runtime?    forum.hibernate.org

52. Throwing runtime exception when max results exceed    forum.hibernate.org

We use Hibernate 3.2.5 and Spring 2.0 in our project. I want to limit the maximum number of records that a query can return so I am using a default max results property of hibernate template in conjunction with setting the property on query objects. In specific scenarios this property will be overridden to retrieve/allow more results. I have the following ...

53. specifying Dialect at runtime    forum.hibernate.org

if ( provider != null && ! provider.trim().startsWith( IMPLEMENTATION_NAME ) ) { 312 log.info( "Required a different provider: " + provider ); 313 return null; 314 ...

54. Configure ApplicationContext at runtime    forum.hibernate.org

Newbie Joined: Tue Jun 10, 2008 4:40 am Posts: 13 I have code like this, then how to change configure file spring.ctx.xml so that i can to configure at runtime? i want change value of this line only, while program is running p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://localhost/hibernate2" p:username="root" p:password="" thanks. file spring.ctx.xml Code:

55. Tables change dynamically during runtime for custom fields    forum.hibernate.org

@Entity @Table(name = "customperson") public class CustomPerson { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer recNum; @Version @Temporal(TemporalType.TIMESTAMP) private Date lastUpdateTime; @OneToOne @JoinColumn(name = "PersonId", unique = true) private Person person; @??? ...

57. Problem configuring Hibernate. SLF4J exception at runtime.    forum.hibernate.org

When i try to run my project i get next exception stack: I can't understand what's the problem, cause i've "imported" all required Hibernate core libraries. Code: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder at org.slf4j.LoggerFactory.(LoggerFactory.java:60) ...