Search Results

Search found 2391 results on 96 pages for 'hibernate'.

Page 17/96 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Unable to instantiate class containing Hibernate code

    - by Steven
    hi, i am developing a plug in which deals with hibernate project.I get some classes which contain Session and Session factory .Then i want to instantiate an object of these classes using reflections which i am not able to do it even after including the hibernate jars in the classpath of my plug in.What is the problem?Help

    Read the article

  • How to check for case sensitive in hibernate criteria

    - by dhiraj
    0 vote down star I have used hibernate to fetch the login information from the mysql database. But the problem is that say for example the user name is 'dhiraj' in the database, now the login is successful by entering the user name, but it is also allowing to enter by taking the user name in uppercase also, e.g., 'DHIRAJ'. I want to restrict it to as it in the database. Can you tell me how to achieve that in hibernate?

    Read the article

  • How to do multiple column UniqueConstraint in hbm?

    - by DataSurfer
    Working on some legacy hibernate code. How do I do the following with hbm.xml(hibernate mapping file) instead of with annotations? @Table(name="users", uniqueConstraints = { @UniqueConstraint(columnNames={"username", "client"}), @UniqueConstraint(columnNames={"email", "client"}) }) public class User implements Serializable { private static final long serialVersionUID = 1L; @Id private int id; private String username; private String email; private Client client; }

    Read the article

  • hibernate - uniqueResult silently fails

    - by robinmag
    I have a login controller that use the hibernate uniqueResult method. Everything works fine when i test it in eclipse's tomcat server. But when i deploy my webapps to tomcat server (on the same machine) it fails: it always returns null even i use the correct credential. Here is my hibernate code: session.createCriteria(User.class) .add(Restrictions.eq(User.USERNAME_FIELD, userName)) .add(Restrictions.eq(User.PASSWORD_FIELD, password)).uniqueResult(); Thank you!

    Read the article

  • Hibernate's version values in Grails app

    - by xain
    I'm looking at a database dump file, and I see many records in various tables with their version number set in values other than 0 (even 94 in one case). I understand it has to do with hibernate locking strategy, but my concern is that today is Sunday, and the site has almost no visitors so is: is this normal ? Or is there a known hibernate bug or even some programming malpractice producing this ?

    Read the article

  • Changing hibernate batch size programatically

    - by user179056
    Hello, Is possible to change hibernate.jdbc.batch_size programmatically? I understand hibernate.jdbc.batch_size is a application level parameter, wanted to know if i can use it specifically for certain HQL inserts and not others. I would change the code only for those HQL inserts The big picture is that i need to introduce batch inserts to make the web application performant in some scenarios, but i do not want to jeopardize the normal inserts which work right now. Any pointers would help thanks Sameer

    Read the article

  • Hibernate Queries

    - by Schildmeijer
    Using Named Queries (located in your hibernate mapping xml file) is a nice way to separate your queries from your buisness logic. But what are the alternatives if your are using Hibernate Annotations for mapping?

    Read the article

  • Hibernate Distributed Cache

    - by DD
    Hi, I'm looking to setup Hibernate with distributed cache where I have one application writing to the DB and another one reading from the DB. Is there an easy way to notify the reading application when the writing one has written through Hibernate? The distributed cache will invalidate the cache but I need the reading application to know a change has been made to refresh its data immediately. Thanks, D

    Read the article

  • Why use Hibernate/nHibernate?

    - by ProgrammingPope
    I have found myself doing a lot of work to get nHibernate setup and am left wondering: Why use a framework like Hibernate/NHibernate? I am sure that quite a few people love the framework but I am unclear on the advantages and disadvantages. What are the advantages and disadvantages of lazy loading, and are there other features to Hibernate? Is there anything that makes a framework like this easier to use (best practices, other frameworks, etc)?

    Read the article

  • Reuse Hibernate session in thread

    - by Marco
    Hello, I've read somewhere that when a session is flushed or a transaction is committed, the session itself is closed by Hibernate. So, how can i reuse an Hibernate Session, in the same thread, that has been previously closed? Thanks

    Read the article

  • Hibernate query cache automatically refreshed on external update?

    - by artgon
    I'm creating a service that has read-only access to the database. I have a query cache and a second level cache enabled (READ_ONLY mode) in Hibernate to speed up the service, as the tables being accessed change rarely. My question is, if someone goes into the DB and changes the tables manually (i.e. outside of Hibernate), does the cache recognize automatically that it needs to be cleared? Is there a time limit on the cache?

    Read the article

  • Virtual PC: Cannot restore machine from hibernate

    - by Paul Lammertsma
    I have two virtual machines set up from Virtual PC on Windows 7 Professional: Windows XP Mode and Xubuntu. Last time I used them (last month or so), I had closed them by hibernating. Evidently, I have meanwhile downloaded a Windows Update affecting VPC and now receive the following error in restoring either of them from hibernation: 'Xubuntu' could not be restored because of either host processor type mismatch or lack of hardware-assisted virtualization support in the system. I've been through the virtual machine's settings, and there's nowhere an option to simply reboot it. (Virtualization is not the problem, as I can create a new virtual machine without any problems.) Any ideas?

    Read the article

  • Windows 7 Standy/Hibernate Freeze/Lockup

    - by Kyle
    I'm running Windows 7 Ultimate on a MSI U100 Netbook which often experiences a lockup or freeze whilst hibernating or shutting down. I have a friend with an Asus netbook running Windows 7 who has experienced the same issue. This happens to me perhaps 1-2 times a week, and is frustrating as hell because it will just sit there running flat out (the fan goes to max after a while) until the battery dies if I don't notice it first. Just wondering if anyone has had any similar issues or might be able to point me in the right direction. The freeze occurs when the screen has faded to black. The HDD light flickers for a few moments then just sticks on solid. I haven't been able to isolate any apps which may be causing this either. It will be fine one standby, and lock up the next with no new apps open. Any thoughts greatly appreciated. Cheers, Kyle

    Read the article

  • Windows 8 auto-hibernate from sleep not working on Retina MacBook Pro

    - by frenchglen
    I have a similar question to this one. Only my context is the 15" Retina MacBook Pro - and Windows 8. I have just the original Mac OS X Mountain Lion on there, then Windows 8 via Bootcamp. no rEFIt installed. (I just press ALT every time I restart windows, actually as a security measure to stop tech-unsavvy thugs, who, if the laptop is stolen, think it's only a mac and don't discover my Windows as quickly as they would've, and by that time I remotely activate various anti-theft mac apps and nab them that way). SO: like the related question asks, why isn't it behaving like it should? The Windows 7 FAQ states: Will sleep eventually drain my laptop battery? If your laptop battery charge gets critically low while the computer is asleep, Windows automatically puts the laptop into hibernation mode. But this is just not happening - on my rMBP Windows 8. It seems EVERY time I set the laptop to sleep (when it reaches 10%), then arriving home and plugging it in and hoping to simply resume my work, it does NOT save the session to disk and I lose ALL my work. Who's fault is it? Win 8's (a bug, grr)? Or Apple's EFI system (maybe fixable via editing EFI options/do I have to install refit to make it work perhaps?) Or maybe changing windows power options can somehow fix the problem? Thanks for your help.

    Read the article

  • Dell Inspiron/Windows Vista sleep/hibernate issue

    - by sarge
    When I hit the sleep button in Windows the computer looks like it's going into Sleep mode but a few seconds later it's restarted, and stops with this error message: internal hard disk drive not found To resolve this issue, try to reseat the drive. No bootable devices--strike F1 to retry boot, F2 for setup utility Press F5 to run onboard diagnostics. The computer is running Windows Vista (SP2) and I have installed all available Windows Updates and the latest manufacturer drivers. I have already tried to reseated the drive, ran the onboard diagnostics and there were no errors. I have changed the power settings for all devices where it's available so that they are not allowed to wake up the computer. Any ideas?

    Read the article

  • Help me find the offending process waking my Windows 7 PC from hibernate every night

    - by DavidGugick
    Recently my Windows 7 64-bit PC has started waking every night from hibernation around 3:30am. I have done the following to try and figure out what is causing the issue with no luck: Examined the Windows Event logs. Nothing is noted Ran powercfg -lastwake and that reports nothing c:\powercfg -lastwake Wake History Count - 1 Wake History [0] Wake Source Count - 0 Ran powercfg to find what devices are armed for wake. Interestingly, this reports two items (I've already unchecked the "Allow this device to wake the computer" in device manager): The keyboard and something called the "eHome Infrared Receiver (USBCIR)". This is a desktop PC and it does not have an Infrared received, so I'm not sure what that device is. Suffice to say it does not have the option to "Allow device to wake..." available in Device Manager. C:\powercfg -devicequery wake_armed eHome Infrared Receiver (USBCIR) HID Keyboard Device My next step is to disable the Keyboard from wake, but I'm not convined that's the problem. This is on a Dell XPS435 if that helps anyone.

    Read the article

  • Alright to truncate database tables when also using Hibernate?

    - by Marcus
    Is it OK to truncate tables while at the same time using Hibernate to insert data? We parse a big XML file with many relationships into Hibernate POJO's and persist to the DB. We are now planning on purging existing data at certain points in time by truncating the tables. Is this OK? It seems to work fine. We don't use Hibernate's second level cache. One thing I did notice, which is fine, is that when inserting we generate primary keys using Hibernate's @GeneratedValue where Hibernate just uses a key value one greater than the highest value in the table - and even though we are truncating the tables, Hibernate remembers the prior value and uses prior value + 1 as opposed to starting over at 1. This is fine, just unexpected. Note that the reason we do truncate as opposed to calling delete() on the Hibernate POJO's is for speed. We have gazillions of rows of data, and truncate is just so much faster.

    Read the article

  • JPA 2.0 Provider Hibernate 3.6 for DB2 v9.5 type 2 driver is throwing exception in configuration prepration

    - by Deep Saurabh
    The JPA 2.0 Provider Hibernate is throwing exception while preparing configuration for entity manager factory, I am using DB2 v9.5 database and DB2 v9.5 JDBC type 2 driver . java.sql.SQLException: [IBM][JDBC Driver] CLI0626E getDatabaseMajorVersion is not supported in this version of DB2 JDBC 2.0 driver. at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throwNotSupportedByDB2(Unknown Source) at COM.ibm.db2.jdbc.app.DB2DatabaseMetaData.getDatabaseMajorVersion(Unknown Source) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:117) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2833) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2829) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1840) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)

    Read the article

  • How to populate Java (web) application with initial data using Spring/JPA/Hibernate

    - by Tuukka Mustonen
    I want to setup my database with initial data programmatically. I want to populate my database for development runs, not for testing runs (it's easy). The product is built on top of Spring and JPA/Hibernate. Developer checks out the project Developer runs command/script to setup database with initial data Developer starts application (server) and begins developing/testing then: Developer runs command/script to flush the database and set it up with new initial data because database structures or the initial data bundle were changed What I want is to setup my environment by required parts in order to call my DAOs and insert new objects into database. I do not want to create initial data sets in raw SQL, XML, take dumps of database or whatever. I want to programmatically create objects and persist them in database as I would in normal application logic. One way to accomplish this would be to start up my application normally and run a special servlet that does the initialization. But is that really the way to go? I would love to execute the initial data setup as Maven task and I don't know how to do that if I take the servlet approach. There is somewhat similar question. I took a quick glance at the suggested DBUnit and Unitils. But they seem to be heavily focused in setting up testing environments, which is not what I want here. DBUnit does initial data population, but only using xml/csv fixtures, which is not what I'm after here. Then, Maven has SQL plugin, but I don't want to handle raw SQL. Maven also has Hibernate plugin, but it seems to help only in Hibernate configuration and table schema creation (not in populating db with data). How to do this?

    Read the article

  • Duplicate a collection of entities and persist in Hibernate/JPA

    - by Michael Bavin
    Hi, I want to duplicate a collection of entities in my database. I retreive the collection with: CategoryHistory chNew = new CategoryHistory(); CategoryHistory chLast = (CategoryHistory)em.createQuery("SELECT ch from CategoryHistory ch WHERE ch.date = MAX(date)").getSingleResult; List<Category> categories = chLast.getCategories(); chNew.addCategories(categories)// Should be a copy of the categories: OneToMany Now i want to duplicate a list of 'categories' and persist it with EntityManager. I'm using JPA/Hibernate. UPDATE After knowing how to detach my entities, i need to know what to detach: current code: CategoryHistory chLast = (CategoryHistory)em.createQuery("SELECT ch from CategoryHistory ch WHERE ch.date=(SELECT MAX(date) from CategoryHistory)").getSingleResult(); Set<Category> categories =chLast.getCategories(); //detach org.hibernate.Session session = ((org.hibernate.ejb.EntityManagerImpl) em.getDelegate()).getSession(); session.evict(chLast);//detaches also its child-entities? //set the realations chNew.setCategories(categories); for (Category category : categories) { category.setCategoryHistory(chNew); } //set now create date chNew.setDate(Calendar.getInstance().getTime()); //persist em.persist(chNew); This throws a failed to lazily initialize a collection of role: entities.CategoryHistory.categories, no session or session was closed exception. I think he wants to lazy load the categories again, as i have them detached. What should i do now?

    Read the article

  • Hibernate limitations on using variables in queries

    - by sammichy
    I had asked the following question I have the following table structure for a table Player Table Player { Long playerID; Long points; Long rank; } Assuming that the playerID and the points have valid values, can I update the rank for all the players based on the number of points in a single query? If two people have the same number of points, they should tie for the rank. And received the answer from Daniel Vassalo (thank you). UPDATE player JOIN (SELECT p.playerID, IF(@lastPoint <> p.points, @curRank := @curRank + 1, @curRank) AS rank, IF(@lastPoint = p.points, @curRank := @curRank + 1, @curRank), @lastPoint := p.points FROM player p JOIN (SELECT @curRank := 0, @lastPoint := 0) r ORDER BY p.points DESC ) ranks ON (ranks.playerID = player.playerID) SET player.rank = ranks.rank; When I try to execute this as a native query in Hibernate, the following exception is thrown. java.lang.IllegalArgumentException: org.hibernate.QueryException: Space is not allowed after parameter prefix ':' Apparently this has been an open issue for the last couple of years, I want to know if the ranking query can be made to work either Without using any variables in the SQL query OR Using any workaround for Hibernate.

    Read the article

  • Using Hibernate's ScrollableResults to slowly read 90 million records

    - by at
    I simply need to read each row in a table in my MySQL database using Hibernate and write a file based on it. But there are 90 million rows and they are pretty big. So it seemed like the following would be appropriate: ScrollableResults results = session.createQuery("SELECT person FROM Person person") .setReadOnly(true).setCacheable(false).scroll(ScrollMode.FORWARD_ONLY); while (results.next()) storeInFile(results.get()[0]); The problem is the above will try and load all 90 million rows into RAM before moving on to the while loop... and that will kill my memory with OutOfMemoryError: Java heap space exceptions :(. So I guess ScrollableResults isn't what I was looking for? What is the proper way to handle this? I don't mind if this while loop takes days (well I'd love it to not). I guess the only other way to handle this is to use setFirstResult and setMaxResults to iterate through the results and just use regular Hibernate results instead of ScrollableResults. That feels like it will be inefficient though and will start taking a ridiculously long time when I'm calling setFirstResult on the 89 millionth row... UPDATE: setFirstResult/setMaxResults doesn't work, it turns out to take an unusably long time to get to the offsets like I feared. There must be a solution here! Isn't this a pretty standard procedure?? I'm willing to forgo Hibernate and use JDBC or whatever it takes. UPDATE 2: the solution I've come up with which works ok, not great, is basically of the form: select * from person where id > <offset> and <other_conditions> limit 1 Since I have other conditions, even all in an index, it's still not as fast as I'd like it to be... so still open for other suggestions..

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >