Search Results

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

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

  • [java bean]hibernate Session breaks a java bean?

    - by blow
    Hi all, i have a simple JPanel bean in my projects, now i want to drag my panel bean class into my jframe. My panel bean class is like this: public class BeanPanel extends javax.swing.JPanel { /** Creates new form BeanPanel */ public BeanPanel () { initComponents(); Session session=HibernateUtil.getSessionFactory().openSession(); } This code seem to break the bean: Session session=HibernateUtil.getSessionFactory().openSession(); When i try to drag the class into my JFrame bean i had this error message: This component cannot be instantiated. Please make sure it is a JavaBeans Component If i comment it all works fine. What is the reason of this? Thanks.

    Read the article

  • Modify database for the SharePoint 2010 Enterprise Search administration web site

    - by Mark Hall
    Does anyone know how to modify the database settings for the Enterprise Search administration web site? When you configure the service application via Central Administration, SharePoint just decides to use the default database server and gives a name like Enterprise_Search_DB_Identifier. I want to modify this to atleast give a name that makes scense like SharePoint_Search_AdministrationWebContent, and it might be nice to move it to the database server that is hosting the crawl and property database. I figured out how to move the Central Administration web content database, but this database is not listed as a content database. It is listed as a Microsoft.Office.Server.Search.Administration.SearchAdminDatabase. I have not tested to see if the same process would work but because you are doing a RemoveContentDatabase and NewContentDatabase, I would assume not. Any help would be appreciated.

    Read the article

  • OneToOne JPA / Hibernate eager loading cause N+1 select

    - by Alexandre Lavoie
    I created a method to have multilingual text on different objects without creating field for each languages or tables for each objects types. Now the only problem I've got is N+1 select queries when doing a simple loading. Tables schema : CREATE TABLE `testentities` ( `keyTestEntity` int(11) NOT NULL, `keyMultilingualText` int(11) NOT NULL, PRIMARY KEY (`keyTestEntity`) ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; CREATE TABLE `common_multilingualtexts` ( `keyMultilingualText` int(11) NOT NULL auto_increment, PRIMARY KEY (`keyMultilingualText`) ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; CREATE TABLE `common_multilingualtexts_values` ( `languageCode` varchar(5) NOT NULL, `keyMultilingualText` int(11) NOT NULL, `value` text, PRIMARY KEY (`languageCode`,`keyMultilingualText`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; MultilingualText.java @Entity @Table(name = "common_multilingualtexts") public class MultilingualText implements Serializable { private Integer m_iKeyMultilingualText; private Map<String, String> m_lValues = new HashMap<String, String>(); public void setKeyMultilingualText(Integer p_iKeyMultilingualText) { m_iKeyMultilingualText = p_iKeyMultilingualText; } @Id @GeneratedValue @Column(name = "keyMultilingualText") public Integer getKeyMultilingualText() { return m_iKeyMultilingualText; } public void setValues(Map<String, String> p_lValues) { m_lValues = p_lValues; } @ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "common_multilingualtexts_values", joinColumns = @JoinColumn(name = "keyMultilingualText")) @MapKeyColumn(name = "languageCode") @Column(name = "value") public Map<String, String> getValues() { return m_lValues; } public void put(String p_sLanguageCode, String p_sValue) { m_lValues.put(p_sLanguageCode,p_sValue); } public String get(String p_sLanguageCode) { if(m_lValues.containsKey(p_sLanguageCode)) { return m_lValues.get(p_sLanguageCode); } return null; } } And it is used like this on a object (having a foreign key to the multilingual text) : @Entity @Table(name = "testentities") public class TestEntity implements Serializable { private Integer m_iKeyEntity; private MultilingualText m_oText; public void setKeyEntity(Integer p_iKeyEntity) { m_iKeyEntity = p_iKeyEntity; } @Id @GeneratedValue @Column(name = "keyEntity") public Integer getKeyEntity() { return m_iKeyEntity; } public void setText(MultilingualText p_oText) { m_oText = p_oText; } @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name = "keyText") public MultilingualText getText() { return m_oText; } } Now, when doing a simple HQL query : from TestEntity, I get a query selecting TestEntity's and one query for each MultilingualText that need to be loaded on each TestEntity. I've searched a lot and found absolutely no solutions. I have tested : @Fetch(FetchType.JOIN) optional = false @ManyToOne instead of @OneToOne Now I am out of idea!

    Read the article

  • Hibernate orm for a view

    - by EugeneP
    How do you ORM a view? Is there any difference with a table in terms of reverse engineering? In my case, I have a whole pile of joined tables that will be read-only in an application. So, if I need sort of a 1 Object with all collections in proper order, instead of long chains of relationships - collection with another etc, it'll be simpler. What do you think and how do you accomplish this?

    Read the article

  • Deleting objects with FK constraints in Spring/Hibernate

    - by maxdj
    This seems like such a simple scenario to me, yet I cannot for the life of my find a solution online or in print. I have several objects like so (trimmed down): @Entity public class Group extends BaseObject implements Identifiable<Long> { private Long id; private String name; private Set<HiringManager> managers = new HashSet<HiringManager>(); private List<JobOpening> jobs; @ManyToMany(fetch=FetchType.EAGER) @JoinTable( name="group_hiringManager", joinColumns=@JoinColumn(name="group_id"), inverseJoinColumns=@JoinColumn(name="hiringManager_id") ) public Set<HiringManager> getManagers() { return managers; } @OneToMany(mappedBy="group", fetch=FetchType.EAGER) public List<JobOpening> getJobs() { return jobs; } } @Entity public class JobOpening extends BaseObject implements Identifiable<Long> { private Long id; private String name; private Group group; @ManyToOne @JoinColumn(name="group_id", updatable=false, nullable=true) public Group getGroup() { return group; } } @Entity public class HiringManager extends User { @ManyToMany(mappedBy="managers", fetch=FetchType.EAGER) public Set<Group> getGroups() { return groups; } } Say I want to delete a Group object. Now there are dependencies on it in the JobOpening table and in the group_hiringManager table, which cause the delete function to fail. I don't want to cascade the delete, because the managers have other groups, and the jobopenings can be groupless. I have tried overriding the remove() function of my GroupManager to remove the dependencies, but it seems like no matter what I do they persist, and the delete fails! What is the right way to remove this object?

    Read the article

  • Search and replace global modifier

    - by mrucci
    Is there any reason why non-global/first-occurrence substitution is the default in many text editing programs (vim, sed, perl, etc.)? I am talking about the /g flag of search and replace commands like: :s/pan/focaccia/g # in vim sed 's/sfortuna/fortuna/g' # with sed that will substitute every occurrence of the search pattern with the replacement string. After (not too) many years of vim and sed usage I still did not find any use case for non-global substitutions. Is there some valid historical reason? Or it is because it is? Thanks.

    Read the article

  • Spring/Hibernate: InvocationTargetException when deleting entity

    - by niklassaers
    I'm sorry if this question is a bit vague, but I'm quite confused. I've got a controller that calls a service to delete an entity and then create an entity in its place. In the service, I've got my DAO, and my entity, and I want to delete my entity, so I call DAO.delete(entity); Then, seemingly out of nowhere, I get an InvocationTargetException. The parameters here are: method: public org.springframework.web.servlet.ModelAndView tld.myproject.view.web.controller.MyController.replaceEntity(org.springframework.web.multipart.MultipartFile,javax.servlet.http.HttpServletRequest) target: tld.myproject.view.web.controller.MyController@185918e args: [org.springframework.web.multipart.commons.CommonsMultipartFile@14812a6, org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest@c08a64] ex: java.lang.reflect.InvocationTargetException private Object doInvokeMethod(Method method, Object target, Object[] args) throws Exception { ReflectionUtils.makeAccessible(method); try { return method.invoke(target, args); } catch (InvocationTargetException ex) { ReflectionUtils.rethrowException(ex.getTargetException()); } throw new IllegalStateException("Should never get here"); } Does anyone have a suggestion to what's going on? Anything I can use in my debugging? Cheers Nik

    Read the article

  • Hibernate cascade delete on a bag

    - by littlecharva
    Howdy, Having built most of my DAL using NHibernate, I've now discovered that the SQL Server's Cascade On Delete rules also need to be taken into account in my HBM files too. I've been using bags for all my collections, but there doesn't seem to be a way to add a cascade="delete" attribute to a bag. I can change all my bags to sets, but that appears to mean I have changing all my IList<s on my models to PersistentGenericSet<s, which I don't really fancy doing. Any advice? Anthony

    Read the article

  • Managing Strategy objects with Hibernate & Spring

    - by Francois
    This is a design question better explained with a Stack Overflow analogy: Users can earn Badges. Users, Badges and Earned Badges are stored in the database. A Badge’s logic is run by a Badge Condition Strategy. I would prefer not to have to store Badge Condition Strategies in the database, because they are complex tree structure objects. How do I associate a Badge stored in the database with its Badge Condition Strategy? I can only think of workaround solutions. For example: create 1 class per badge and use a SINGLE_TABLE inheritance strategy. Or get the badge from the database, and then programmatically lookup and inject the correct Badge Condition Strategy. Thanks for suggesting a better design.

    Read the article

  • Hibernate SessionFactory: how to configure JNDI in Tomcat?

    - by EugeneP
    that's how the session factory should be gotten: protected SessionFactory getSessionFactory() { try { return (SessionFactory) new InitialContext() .lookup("SessionFactory"); } catch (Exception e) { } } Please provide a simple solution for Tomcat6 to be able to get SessionFactory thru simple jndi lookup in Java code. What should be written in what file on the side of Tomcat ?

    Read the article

  • Criteria hibernate

    - by apb
    my code session.createCriteria(Input.class); DateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Date startDate = (Date)format.parse("2005-01-01 00:00:00"); Date endDate = (Date)format.parse("2005-03-03 00:00:00"); crit.add(Expression.between ("inputDate", new Date(startDate.getTime()), new Date(endDate.getTime()))); This code return a list, but there is no element present in it. i think it doesn't match the condition. Anybody help.

    Read the article

  • Hibernate: same generated value in two properties

    - by Markos Fragkakis
    Hi, I have an entity A with fields: aId (the system id) bId I want the first to be generated: @Id @Column(name = "PRODUCT_ID", unique = true, nullable = false, precision = 12, scale = 0) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PROD_GEN") @BusinessKey public Long getAId() { return this.aId; } I want the bId to be initially exactly as the aId. One approach is to insert the entity, then get the aId generated by the DB (2nd query) and then update the entity, setting the bId to be equal to aId (3rd query). Is there a way to get the bId to get the same generated value as aId? Note that afterwards, I want to be able to update bId from my gui. If the solution is JPA, even better.

    Read the article

  • hibernate createSQL how to cache it?

    - by cometta
    If i use Criteria statement, i able to use cache easily. but when i using custom CREATESQL, like below, how do i cache it? Query query = getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery( " select company_keysupplier.ddiv as ddiv, company_division.name as DIVISION, company_keysupplier.ddep as ddep,company_department.name as DEPARTMENT"+ " from company_keysupplier "+ " left join company_division on "+ " (company_keysupplier.ddiv= company_division.division_code and company_keysupplier.survey_num=company_division.survey_num) "+ " left join company_department on "+ " (company_keysupplier.ddep= company_department.department_code and company_keysupplier.survey_num=company_department.survey_num) "+ " where company_keysupplier.sdiv = :sdiv and company_keysupplier.sdep = :sdep and company_keysupplier.survey_num= :surveyNum " + " order by company_division.name, company_keysupplier.ddep " ) .addScalar("ddiv") .addScalar("ddep") .addScalar("DIVISION") .addScalar("DEPARTMENT") .setResultTransformer(Transformers.aliasToBean(IssKeysupplier.class)); query.setString("sdiv", sdiv); query.setString("sdep", sdepartment); query.setBigInteger("surveyNum", survey_num); //i tried query.setCachable(true) fail...... List result= (List<IssKeysupplier>)query.list(); return result;

    Read the article

  • Hibernate Discriminator sort

    - by mrvreddy
    I am trying to sort the records when queried on discriminator column. I am doing a HQL/ Criteria query for retrieving all the records. Here is my class: abstract class A { ... } @DiscriminatorValue("B") class B extends A { } @DiscriminatorValue("C") class C extends A { } When I return the records, I want it sorted on the discriminator value.

    Read the article

  • Hibernate is persisting entity during flush when the entity has not changed

    - by Preston
    I'm having a problem where the entity manger is persisting an entity that I don't think has changed during the flush. I know the following code is the problem because if I comment it out the entity doesn't persist. In this code all I'm doing is loading the entity and calling some getters. Query qry = em.createNamedQuery("Clients.findByClientID"); qry.setParameter("clientID", clientID); Clients client = (Clients) qry.getSingleResult(); results.setFname(client.getFirstName()); results.setLname(client.getLastName()); ... return results; Later in a different method I do another namedQuery which causes the entity manger to flush. For some reason the client loaded above is persisted. The reason this is a problem is because in the middle of all this, there is some old code that is making some straight JDBC changes to the client. When the entity manger persists the changes made by the straight JDBC are lost. The theory we have at moment is that the entity manger is comparing the entity to the underlying record, sees that it's different, then persists it. Can someone explain or confirm the behavior we're seeing?

    Read the article

  • Remove then Query fails in JPA/Hibernate (deleted entity passed to persist)

    - by Kevin
    I've got a problem with the removal of entities in my JPA application: basically, I do in this EJB Business method: load photo list ; for each photo { //UPDATE remove TagPhoto element from @OneToMany relation //DISPLAY create query involving TagPhoto ... } and this last query always throws an EntityNotFoundException (deleted entity passed to persist: [...TagPhoto#]) I think I understand the meaning of this exception, like a synchronization problem caused by my Remove, but how can I get rid of it?

    Read the article

  • hibernate not throwing stale state exception nor it is overwriting data

    - by Reddy
    Our application do the following. 1. Start the transaction. 2. Execute a query using prepared statement 3. Check a condition to see the number of rows updated are equal to the required number. 4. It commits on success of above condition otherwise it will roll back However the problem is that when two threads are simultaneously enter this code. Thread-1 is updating a row in step 2. It checked the condition and committed successfully since the condition is successful. Thread-2 started execution somewhere between steps 1 & 4, and it is failing on at condition checking at step 3 (as it is getting number of updated rows as 0). I expected second thread to throw an exception but it is not. What could be the problem?

    Read the article

  • Grails/Hibernate max for string type

    - by bsreekanth
    Hello, In my table I have a serial number field, which is represneted by string.. It has a prefix and some numbers follow. Eg: ABC1234, ABC2345 etc. How to retrieve the largest value (max equivalent of int type) from this column. In my case it would be ABC2345. I probably could retrieve all the data,, sort it and get the same, but that would be slow. thanks in advance..

    Read the article

  • Hibernate question hbm2ddl.auto possible values and what they do

    - by Suzan
    I really want to know more about the update, export and the values that could be given to hbm2ddl.auto. I need to know when to use the update and when not? And what is the alternative? These are changes that could happen over DB: New tables new columns in old tables columns deleted data type of a column changed a type of a column changed it attributes tables have been dropped values of a column has changed In each case what is the best solution?

    Read the article

  • 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

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