Search Results

Search found 18361 results on 735 pages for 'hibernate search'.

Page 52/735 | < Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >

  • Hibernate and default values

    - by Schildmeijer
    Is it possible to use annotations to map a default value for a column? eg. I have a column named 'date' which is supposed to be '0000-00-00 00:00:00' if not date is explicitly given. I know I can add this to the ctor of the Entity. But then the default behavior will no be present in my database backend. (eg. Default column in mysql)

    Read the article

  • HIbernate query language problem.....

    - by mslatf
    I have a Project class that has a Set of userstories called userStories12many. I'm having troubles trying to get the project that has a certain userstory in its set getComponent(int userStoryID) I think im on the right track but i dont know what i did wrong public Projects getComponent(int userStoryID) { Session session = SessionFactoryHelper.getSessionFactory() .getCurrentSession(); session.beginTransaction(); List<Projects> compo = session.createQuery("select p " + "from Projects as p inner join fetch p.userStories12many as u " + "where u.storyId='" + userStoryID + "'").list(); session.getTransaction().commit(); return compo.get(0); }

    Read the article

  • How to handle choice field with JPA 2, Hibernate 3.5

    - by phmr
    I have an entity with Integer attributes that looks like this in proto code: class MyEntity: String name Integer frequency Integer type def getFrequency() def getType() get* accessors return strings according to this table. value(type) HumanReadableString(type) 1 BSD 2 Apache 3 GPL min frequency max frequency HumanReadableString(frequency) 0 1000 rare 1000 2000 frequent 2001 3000 sexy It should be possible to get all possible values that an attribute can take, example: getChoices(MyEntity, "type") returns ("rare", "frequent", "sexy") It should be possible to get the bound value from the string: getValue(MyEntity, "frequency", "sexy") returns (2000,3000)

    Read the article

  • Many returned records cause stackoverflow with Hibernate

    - by mimi law
    If there are many return records from DB. It will get stackoverflow problem. User is a class, which has a one to many relationship (to 3 other classes). When I print out the SQL, i found that the system runs the same query many time to get the data from DB. Does anyone know what the problem is? result.addAll(getCurrentSession().createCriteria(User.class) .add(Restrictions.ilike("name", "tom", MatchMode.ANYWHERE)) .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY) .list());

    Read the article

  • Hibernate cascade debug options

    - by Chris
    I have run into various StackOverflowErrors which occur during cascading. These have been extremely time consuming in debugging because I don't know which properties are being cascaded to cause this recursive behavior. Does anyone know of a log setting or some other form of debugging which could tell me specifically what properties are being cascaded?

    Read the article

  • DB2 Query to Hibernate Criteria

    - by Fortega
    Hi, I have a specific DB2 query, and I would like to execute this query using criteria. The query: SELECT sum(units) as volume, location_id, aged FROM ( SELECT units, location_id, CASE WHEN daysinstock < 61 THEN 'NOT_AGED' WHEN daysinstock < 91 THEN 'AGED' ELSE 'OVER_AGED' END AS AGED FROM STOCK_TABLE ) x group by location_id, aged the STOCK_TABLE contains the following fields: units, location_id, daysinstock. This table is matched by a StockDataSource object, with the same fields.

    Read the article

  • vim: highlighting a search term without moving the cursor

    - by ajwood
    Using Vim, I sometimes find myself staring at a section of source code for a while and suddenly want some variable on the screen to pop out. That's easy: /<var> which highlights them all. My issue is that it more often than not the search shifts my window so I'm not looking at the source code from the same place. Even if it's only shifted a few lines, it's still throws me off since I need to take a few seconds to figure out where things have moved to. Is it possible to highlight a search term without moving the cursor to the next match?

    Read the article

  • Change google search location beyond current country

    - by Abel
    I often work remotely and prefer using en-us locale settings for my searches. One of our computers is located in Germany, and whenever I try to change the location in Google Search Settings, I get an answer to "Pleas enter a valid Deutschland city or zip code". I checked this post, but it doesn't apply, as my language settings en-us and the Google search language is also set to English. It clearly uses the IP address of the computer. I couldn't find an answer in the Google help pages, anyone any idea how to change it London, New-York or Amsterdam?

    Read the article

  • Hibernate Updating an existing entity with a new object

    - by DD
    Hi, Assume I have an entity Foo in the DB. I am parsing some files and creating new Foo objects and would like to check if the parsed Foo object exists in the DB (using a unique attribute). If it exists already update it otherwise save as a new object. What is the best approach? Could I simply set the id and version in the new Foo object? Or would I be better off loading the Foo object from the DB and copying over the properties from the parsed file? Thanks.

    Read the article

  • backup, sync and search files over internet and intranet

    - by Cawas
    There are many online backup options out there. Dropbox, Sugarsync, Mozy, Carbonite, Jungledisk and my favorite so far, Crashplan. Some of them allow searching, all of them sync with their online servers, none of those (or many many others I didn't listed here) have what I want. I'm _not_ looking for an online backup service in here. Sure, some people might say "use rsync", "linux" and/or "set up apache" and so on... But that's just too much for maintenance, if it's even viable of building up. It needs to be simple. So, anyone knows of a really good solution out there? Picture mostly Google Desktop Search (or quick search) awesome searching, mixed with Crashplan Desktop, which is able to do everything by itself, and something like Dropbox's file versioning, along with dropbox the ability to seamless sync over intranet and internet like crashplan, switching between them when needed. I bet there's nothing like this yet, but well, I'm not sure. It would be great!

    Read the article

  • Constant in Hibernate Mapping Files

    - by bertolami
    I would like to add a value object to a mapped class where one column is fixed depending of the class that contains the component. How can I do something like this? <component name="aComponent"> <property name="abc" column="cde"/> <property name="xyz" value="FIXED"/> </component> Unfortunatly, the value attribute does not exist. Is there another way to apply a constant value to property? Thanks in advance.

    Read the article

  • Add Control Panel items to Windows 8.1 Search

    - by Alec
    Windows 8.1 claims to search in all indexed locations. However when I tried to open "Mail" (i.e. Mlcfg32.cpl) by typing "Mail" in Search, magic didn't happen. Instead I had to scramble all the way through Control Panel. Is it possible to add Control Panel items to those indexed locations? Or is it just the thing Microsoft forgot about? (e.g. forgot on intention, so users would make use of their new "Settings" applet).

    Read the article

  • "Press Tab to search <site>" in Chrome not working

    - by YatharthROCK
    The problem After partially entering a URL like meta.st, Chrome adds in the rest of the URL slected in blue and says "Press Tab to search Meta Stack Overflow". But on pressing, it just moves the cursor to the next item like in a normal text-field. Other info I'm on Windows 7 Home Basic. My Chrome version number is 22.0.1229.52 beta-m (beta channel). This was working before. What I've tried I've reported it in Chrome (by going to Options Tools Report an issue...). I've also tried deleting all my custom search engines (they might've been interfering) and also tried creating a new profile. I also googled, but to no avail. How do I fix this? Thanks.

    Read the article

  • Spring & Hibernate SessionFactory - recovery from a down server

    - by MJB
    So pre spring, we used version of HibernateUtil that cached the SessionFactory instance if a successful raw JDBC connection was made, and threw SQLException otherwise. This allowed us to recover from initial setup of the SessionFactory being "bad" due to authentication or server connection issues. We moved to Spring and wired things in a more or less classic way with the LocalSessionFactoryBean, the C3P0 datasource, and various dao classes which have the SessionFactory injected. Now, if the SQL server appears to not be up when the web app runs, the web app never recovers. All access to the dao methods blow up because a null sessionfactory gets injected. (once the sessionfactory is made properly, the connection pool mostly handles the up/down status of the sql server fine, so recovery is possible) Now, the dao methods are wired by default to be singletons, and we could change them to prototype. I don't think that will fix the matter though - I believe the LocalSessionFactoryBean is now "stuck" and caches the null reference (I haven't tested this yet, though, I'll shamefully admit). This has to be an issue that concerns people.

    Read the article

  • Hibernate one to one with multiple columns

    - by Erdem Emekligil
    How can i bind two columns, using @OneToOne annotation? Lets say I've 2 tables A and B. Table A: id1 (primary key) id2 (pk) other columns Table B: id1 (pk) id2 (pk) other columns In class A i want to write something like this: @OneToOne(fetch = FetchType.EAGER, targetEntity = B.class) @JoinColumn(name = "id1 and id2", referencedColumnName = "id1 and id2") private B b; Is it possible to do this using annotations? Thanks.

    Read the article

  • Strange befaviour of spring transaction support for JPA + Hibernate +@Transactional annotation

    - by abovesun
    I found out really strange behavior on relatively simple use case, probably I can't understand it because of not deep knowledges of spring @Transactional nature, but this is quite interesting. I have simple User dao that extends spring JpaDaoSupport class and contains standard save method: @Transactional public User save(User user) { getJpaTemplate().persist(user); return user; } If was working fine until I've add new method to same class: User getSuperUser(), this method should return user with isAdmin == true, and if there is no super user in db, method should create one. Thats how it was looking like: public User createSuperUser() { User admin = null; try { admin = (User) getJpaTemplate().execute(new JpaCallback() { public Object doInJpa(EntityManager em) throws PersistenceException { return em.createQuery("select u from UserImpl u where u.admin = true").getSingleResult(); } }); } catch (EmptyResultDataAccessException ex) { User admin = new User('login', 'password'); admin.setAdmin(true); save(admin); // THIS IS THE POINT WHERE STRANGE THING COMING OUT } return admin; } As you see code is strange forward and I was very confused when found out that no transaction was created and committed on invocation of save(admin) method and no new user wasn't actually created despite @Transactional annotation. In result we have situation: when save() method invokes from outside of UserDAO class - @Transactional annotation counted and user successfully created, but if save() invokes from inside of other method of the same dao class - @Transactional annotation ignored. Here how I was change save() method to force it always create transaction. public User save(User user) { getJpaTemplate().execute(new JpaCallback() { public Object doInJpa(EntityManager em) throws PersistenceException { em.getTransaction().begin(); em.persist(user); em.getTransaction().commit(); return null; } }); return user; } As you see I manually invoke begin and commit. Any ideas?

    Read the article

  • Mapping enum to a table with hibernate annotation

    - by Thierry-Dimitri Roy
    I have a table DEAL and a table DEAL_TYPE. I would like to map this code: public class Deal { DealType type; } public enum DealType { BASE("Base"), EXTRA("Extra"); } The problem is that the data already exist in the database. And I'm having a hard time mapping the classes to the database. The database looks something like that: TABLE DEAL { Long id; Long typeId; } TABLE DEAL_TYPE { Long id; String text; } I know I could use a simple @OneToMany relationship from deal to deal type, but I would prefer to use an enum. Is this possible? I almost got it working by using a EnumType.ORDINAL type. But unfortunately, my IDs in my deal type table are not sequential, and do not start at 1. Any suggestions?

    Read the article

  • How can this be done with (N)Hibernate?

    - by Vilx-
    I'm creating a windows forms application with NHibernate. It's an MDI application, so there is no limit to how many forms the user can have open at the same time (probably many). For most forms I want to have an "OK" and a "Cancel" button. Both close the form, but "OK" also saves the modified data to the DB. The forms can be pretty complex, and the modifications are likely to touch a whole graph of objects, adding some, deleting some, and changing some more. It would be good if the changes could be automatically detected and persisted as needed, without the need to manually keep track of each of them. What would be a good way to do this? Extra information: I can make whatever DB schema I want. I'm using MSSQL 2008 and currently have decided for GUID primary keys (with guid.comb generator) and a TIMESTAMP column for optimistic concurrency. I tried to simply set FlushMode of a NHibernate ISession to Never, doing all modifications as needed, and then calling Flush() if the user clicked OK. But that didn't work.

    Read the article

  • what does synchronization mean in hibernate..

    - by abc
    i read that upon session.flush() The data will be synchronized (but not committed) when session.flush() is called what is synchronized with what.. whether it is DB state that will come to memory by querying or memory state will be copied to Db ? clarify this plz..

    Read the article

  • Hibernate @PostLoad problem

    - by tropikalista
    Looked at many forums but haven't found answer...Simple stuff, method annotated with @PostLoad newer gets invoked...added listener via @EntityListeners but problem remains. I'm using SessionFactory based configuration.

    Read the article

< Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >