Search Results

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

Page 140/735 | < Previous Page | 136 137 138 139 140 141 142 143 144 145 146 147  | Next Page >

  • Prevent bot from crawling certain areas of site.

    - by Skoder
    Hey, I don't know much about SEO and how web spiders work, so forgive my ignorance here. I'm creating a site (using ASP.NET-MVC) which has areas that displays information retrieved from the database. The data is unique to the user, so there's no real server-side output caching going on. However, since the data can contain things the user may not wish to have displayed from search engine results, I'd like to prevent any spiders from accessing the search results page. Are there any special actions I should take to ensure that the search result directory isn't crawled? Also, would a spider even crawl a page that's dynamically generated and would any actions preventing certain directories being search mess up my search engine rankings? edit: I should add, I'm reading up on robots.txt protocol, but it relies on co-operation from the web crawler. However, I'd also like to prevent any data-mining users who will ignore the robots.txt file. I appreciate any help!

    Read the article

  • Searching for Records

    - by 47
    I've come up with a simple search view to search for records in my app. The user just enters all parameters in the search box then all this is matched against the database, then results are returned. One of these fields is the phone number....now in the database it's stored in the format XXX-XXX-XXX. A search, for example, for "765-4321" pull up only "416-765-4321...however I want it to return both "416-765-4321" and "4167654321" My view is as below: def search(request, page_by=None): query = request.GET.get('q', '') if query: term_list = query.split(' ') q = Q(first_name__icontains=term_list[0]) | Q(last_name__icontains=term_list[0]) | Q(email_address__icontains=term_list[0]) | Q(phone_number__icontains=term_list[0]) for term in term_list[1:]: q.add((Q(first_name__icontains=term) | Q(last_name__icontains=term) | Q(email_address__icontains=term) | Q(phone_number__icontains=term)), q.connector) results = Customer.objects.filter(q).distinct() all = results.count() else: results = [] if 'page_by' in request.GET: page_by = int(request.REQUEST['page_by']) else: page_by = 50 return render_to_response('customers/customers-all.html', locals(), context_instance=RequestContext(request))

    Read the article

  • Searching documents by tag using the Scribd API is no longer returning expected results.

    - by George
    Recently I have encountered an issue with Scribd where searching via Scribd API (docs.search) for documents by tag is no longer working. This has been working (for over 6 months) to return a number of documents that I have tagged with "fdsafetyandprevention" (accessible here http://www.scribd.com/tag/fdsafetyandprevention). Just recently my search via the API has stopped working. Note that test searches such as @tags "selfhelp" as described in the Scribd documentation DO work. Could my issue be related to caching or the age of my documents and Scribd choosing to not return them in search results? I have been using scribd.php (http://www.scribd.com/developers/libraries) to interface with the API using $scribd-search(@tags "fdsafetyandprevention", 20, 0, "all"). I am following the Scribd documentation for docs.search and advanced help (http://www.scribd.com/developers/search_help). Help greatly appreciated. George.

    Read the article

  • i get the exception org.hibernate.MappingException: No Dialect mapping for JDBC type: -9

    - by ramesh m
    i am using hibernate .i wrote Native sql query. this query will be execute in sqlSever command promt try { session=HibernateUtil.getInstance().getSession(); transaction=session.beginTransaction(); SQLQuery query = session.createSQLQuery("SELECT AP.PROJECT_NAME, AP.SKILLSET, PA.START_DATE, PA.END_DATE, RS.EMPLOYEE_ID, RS.EMPLOYEE_NAME, RS.REPORTING_PM FROM RESOURCE_MASTER RS,SHARED_PROPOSAL S, ACTUAL_PROPOSAL AP, PROJECT_APPROVED PA, PROJECT_ALLOCATION PL WHERE RS.EMPLOYEE_ID = PL.EMPLOYEE_ID AND PA.PROJECT_ID = PL.PROJECT_ID AND PA.SHARED_PROPOSAL_ID = S.SHARED_PROPOSAL_ID AND S.ACTUAL_PROPOSAL_ID=AP.ACTUAL_PROPOSAL_ID"); List<Object[]> obj=query.list(); Object[] object=new Object[arrayList.size()]; for (int i = 0; i < arrayList.size(); i++) { object[i]=arrayList.get(i); System.out.println(object[i]); } arrayList.get(0); String name=(String)arrayList.get(0); logger.info("In find All searchDeveloper"); }catch(Exception exception) { throw new PPAMException("Contact admin","Problem retrieving resource master list",exception); } like that i am using on that time i got this Exception: org.hibernate.MappingException: No Dialect mapping for JDBC type: -9 this query is executed in sqlserver command propt , i maaped seven tables, but remove ACTUAL_PROPOSAL AP table .it is execute correctly please help me

    Read the article

  • Mixed surrogate composite key insert in JPA 2.0, PostgreSQL and Hibernate 3.5

    - by Gerald
    First off, we are using JPA 2.0 and Hibernate 3.5 as persistence provider on a PostgreSQL database. We successfully use the sequence of the database via the JPA 2.0 annotations as an auto-generated value for single-field-surrogate-keys and all works fine. Now we are implementing a bi-temporal database-scheme that requires a mixed key in the following manner: Table 1: id (pk, integer, auto-generated-sequence) validTimeBegin (pk, dateTime) validTimeEnd (dateTime) firstName (varChar) Now we have a problem. You see, if we INSERT a new element, the field id is auto-generated and that's fine. Only, if we want to UPDATE the field within this scheme, then we have to change the validTimeBegin column WITHOUT changing the id-field and insert it as a new row like so: BEFORE THE UPDATE OF THE ROW: |---|-------------------------|-------------------------|-------------------| | id| validTimeBegin | validTimeEnd | firstName | |---|-------------------------|-------------------------|-------------------| | 1| 2010-05-01-10:00:00.000 | NULL | Gerald | |---|-------------------------|-------------------------|-------------------| AFTER THE UPDATE OF THE ROW happening at exactly 2010-05-01-10:35:01.788 server-time: (we update the person with the id:1 to reflect his new first name...) |---|-------------------------|-------------------------|-------------------| | id| validTimeBegin | validTimeEnd | firstName | |---|-------------------------|-------------------------|-------------------| | 1| 2010-05-01-10:00:00.000 | 2010-05-01-10:35:01.788 | Gerald | |---|-------------------------|-------------------------|-------------------| | 1| 2010-05-01-10:35:01.788 | NULL | Jerry | |---|-------------------------|-------------------------|-------------------| So our problem is, that this doesn't work at all using an auto-generated-sequence for the field id because when inserting a new row then the id ALWAYS is auto-generated although it really is part of a composite key which should sometimes behave differently. So my question is: Is there a way to tell hibernate via JPA to stop auto-generating the id-field in the case I want to generate a new variety of the same person and go on as usual in every other case or do I have to take over the whole id-generation with custom code? Thanks in advance, Gerald

    Read the article

  • JDBC connection for a background thread being closed accessing in Websphere

    - by ferrari fan
    Hi, I have an application running in Websphere Portal Server inside of Websphere Application Server 6.0 (WAS). In this application for one particular functionality that takes a long time to complete, I am firing a new thread that performs this action. This new thread opens a new Session from Hibernate and starts performing DB transactions with it. Sometimes (haven't been able to see a pattern), the transactions inside the thread work fine and the process completes successfully. Other times however I get the errors below: org.hibernate.exception.GenericJDBCException: could not load an entity: [OBJECT NAME#218294] ... Caused by: com.ibm.websphere.ce.cm.ObjectClosedException: DSRA9110E: Connection is closed. Method cleanup failed while trying to execute method cleanup on ManagedConnection WSRdbManagedConnectionImpl@642aa0d8 from resource jdbc/MyJDBCDataSource. Caught exception: com.ibm.ws.exception.WsException: DSRA0080E: An exception was received by the Data Store Adapter. See original exception message: Cannot call 'cleanup' on a ManagedConnection while it is still in a transaction.. How can I stop this from happening? Why does it seem that WAS wants to kill my connections even though they're not done. Is there a way I can stop WAS from attempting to close this particular connection? Thanks

    Read the article

  • How to generating comments in hbm2java created POJO?

    - by jschoen
    My current setup using hibernate uses the hibernate.reveng.xml file to generate the various hbm.xml files. Which are then turned into POJOs using hbm2java. We spent some time while designing our schema, to place some pretty decent descriptions on the Tables and there columns. I am able to pull these descriptions into the hbm.xml files when generating them using hbm2jhbmxml. So I get something similar to this: <class name="test.Person" table="PERSONS"> <comment>The comment about the PERSONS table.</comment> <property name="firstName" type="string"> <column name="FIRST_NAME" length="100" not-null="true"> <comment>The first name of this person.</comment> </column> </property> <property name="middleInitial" type="string"> <column name="MIDDLE_INITIAL" length="1"> <comment>The middle initial of this person.</comment> </column> </property> <property name="lastName" type="string"> <column name="LAST_NAME" length="100"> <comment>The last name of this person.</comment> </column> </property> </class> So how do I tell hbm2java to pull and place these comments in the created Java files? I have read over this about editing the freemarker templates to change the way code is generated. I under stand the concept, but it was not to detailed about what else you could do with it beyond there example of pre and post conditions.

    Read the article

  • How to generate comments in hbm2java created POJO?

    - by jschoen
    My current setup using hibernate uses the hibernate.reveng.xml file to generate the various hbm.xml files. Which are then turned into POJOs using hbm2java. We spent some time while designing our schema, to place some pretty decent descriptions on the Tables and there columns. I am able to pull these descriptions into the hbm.xml files when generating them using hbm2jhbmxml. So I get something similar to this: <class name="test.Person" table="PERSONS"> <comment>The comment about the PERSONS table.</comment> <property name="firstName" type="string"> <column name="FIRST_NAME" length="100" not-null="true"> <comment>The first name of this person.</comment> </column> </property> <property name="middleInitial" type="string"> <column name="MIDDLE_INITIAL" length="1"> <comment>The middle initial of this person.</comment> </column> </property> <property name="lastName" type="string"> <column name="LAST_NAME" length="100"> <comment>The last name of this person.</comment> </column> </property> </class> So how do I tell hbm2java to pull and place these comments in the created Java files? I have read over this about editing the freemarker templates to change the way code is generated. I under stand the concept, but it was not to detailed about what else you could do with it beyond there example of pre and post conditions.

    Read the article

  • Cannot enlist Synchronization. LocalTransactionCoordinator is completing or completed issue with hib

    - by Bijendra Singh
    I am getting Cannot enlist Synchronization. LocalTransactionCoordinator is completing or completed exception when integrating my method is called from the portlet. I am using spring transaction management for handling all the hibernate transaction in the spring configuration file through AOP. When I run my hibernate dao method for persisting the data through Junit its working fine. Exception description: I am facing an issue that is when I run my code through unit test case data is getting updated in database properly but when I run the same code with integration with portlet my code is executing finely but after the completion of transaction the records is not getting updated to database. The following error can be seen in the log which is [4/7/10 23:06:38:685 MDT] 0000006c LocalTranCoor E WLTC0014E: Cannot enlist Synchronization. LocalTransactionContainment is completing or completed. [4/7/10 23:06:38:689 MDT] 0000006c LocalTransact E J2CA0026E: Method addSync caught java.lang.IllegalStateException: Cannot enlist Synchronization. LocalTransactionCoordinator is completing or completed. at com.ibm.ws.LocalTransaction.LocalTranCoordImpl.enlistSynchronization(LocalTranCoordImpl.java(Compiled Code)) at com.ibm.ejs.j2c.LocalTransactionWrapper.addSync(LocalTransactionWrapper.java(Compiled Code)) at com.ibm.ejs.j2c.ConnectionManager.initializeForUOW(ConnectionManager.java(Compiled Code)) at com.ibm.ejs.j2c.ConnectionManager.involveMCInTran(ConnectionManager.java(Compiled Code)) at com.ibm.ejs.j2c.ConnectionManager.associateConnection(ConnectionManager.java(Compiled Code)) at com.ibm.ejs.j2c.ConnectionManager.associateConnection(ConnectionManager.java(Compiled Code)) at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.reactivate(WSJdbcConnection.java(Compiled Code)) at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.getWarnings(WSJdbcConnection.java:1539)

    Read the article

  • Maven doesn't compile target/hibernate3/generated-sources

    - by mmm
    Can someone tell me how to configure maven for it also to compile sources from the target/hibernate3/generated-sources directory? I have already read this and other posts but they don't seem to solve my problem (which indeed seems trivial). I have used the bottom-up approach hibernate configuration for cfg.xml, hbm.xml and POJO generation (i.e. auto-generated the complete hibernate configuration out of an existing database schema). I'm also only using standard maven and hibernate3-plugin directory layouts. Yet, when executing mvn compile in the command-line while my sources are in the src/main/java and the generated sources in /target/hibernate3/generated-sources only the ones from src/main/java get compiled and copied into target/classes. I wouldn't like to generate sources into src/main/java as I'd like mvn clean to clean them. I'd like to solve the problem using command-line, plugins and pom.xml only. Is there a way to configure maven-compiler-plugin to do so? Or is there another way? Regards and thanks for any help.

    Read the article

  • error : java.lang.String cannot be cast to coldfusion.cfc.CFCBeanProxy anyone know about this ?

    - by faheem
    Hi does anyone know about this error I get when I try to insert a foreign key value in my entry entity using cf9 Hibernate ? java.lang.ClassCastException: java.lang.String cannot be cast to coldfusion.cfc.CFCBeanProxy Root cause :org.hibernate.HibernateException: java.lang.ClassCastException: java.lang.String cannot be cast to coldfusion.cfc.CFCBeanProxy Below is the code for my entity object and then for my user object.. Is there anything wrong with this ? entry.cfc /** * Entries Object */ component output="false" persistent="true"{ property name="entry_id" fieldType="id" generator="uuid"; property name="entryBody" ormType="text"; property name="title" notnull="true" type="string"; property name="time" fieldtype="timestamp"; property name="isCompleted" ormType="boolean" dbdefault="0" default="false"; property name="userID" fieldtype="many-to-one" fkcolumn="userID" cfc="user"; Entry function init() output=false{ return this; } } user.cfc /** * Users Object */ component output="false" persistent="true"{ property name="userID" fieldType="id" generator="uuid"; property name="firstName" notnull="true" type="string"; property name="lastName" notnull="true" type="string"; property name="password" notnull="true" type="string"; property name="userType" notnull="true" type="string"; //property name="entry" fieldtype="one-to-many" type="array" fkcolumn="userID" cfc="entry"; User function init() output=false{ return this; } }

    Read the article

  • How to trace the connection pool in a Java Web application - DBMS_APPLICATION_INFO

    - by Cleiton Garcia
    Hello, I need improve the traceability in a Web Application that usually run on fixed db user. The DBA should have a fast access for the information about the heavy users that are degrading the database. 5 years ago, I implemented a .NET ORM engine which makes a log of user and the server using the DBMS_APPLICATION_INFO package. Using a wrapper above the connection manager with the following code: DBMS_APPLICATION_INFO.SET_MODULE('" + User + " - " + appServerMachine + "',''); Each time that a connection get a connection from the pool, the package is executed to log the information in the V$SESSION. Has anyone discover or implemented a solution for this problem using the Toplink or Hibernate? Is there a default implementation for this problem? I found here a solutions as I implemented 5 years ago, but I'd like to know with anyone have a better solution and integrated with the ORM. http://stackoverflow.com/questions/53379/using-dbmsapplicationinfo-with-jboss My application is above Spring, the DAO are implemented with JPA (using hibernate) and actually running directly in Tomcat, with plans to (next year) migrate to SAP Netwevare Application Server. Thanks.

    Read the article

  • Why put a DAO layer over a persistence layer (like JDO or Hibernate)

    - by Todd Owen
    Data Access Objects (DAOs) are a common design pattern, and recommended by Sun. But the earliest examples of Java DAOs interacted directly with relational databases -- they were, in essence, doing object-relational mapping (ORM). Nowadays, I see DAOs on top of mature ORM frameworks like JDO and Hibernate, and I wonder if that is really a good idea. I am developing a web service using JDO as the persistence layer, and am considering whether or not to introduce DAOs. I foresee a problem when dealing with a particular class which contains a map of other objects: public class Book { // Book description in various languages, indexed by ISO language codes private Map<String,BookDescription> descriptions; } JDO is clever enough to map this to a foreign key constraint between the "BOOKS" and "BOOKDESCRIPTIONS" tables. It transparently loads the BookDescription objects (using lazy loading, I believe), and persists them when the Book object is persisted. If I was to introduce a "data access layer" and write a class like BookDao, and encapsulate all the JDO code within this, then wouldn't this JDO's transparent loading of the child objects be circumventing the data access layer? For consistency, shouldn't all the BookDescription objects be loaded and persisted via some BookDescriptionDao object (or BookDao.loadDescription method)? Yet refactoring in that way would make manipulating the model needlessly complicated. So my question is, what's wrong with calling JDO (or Hibernate, or whatever ORM you fancy) directly in the business layer? Its syntax is already quite concise, and it is datastore-agnostic. What is the advantage, if any, of encapsulating it in Data Access Objects?

    Read the article

  • Java Mvc And Hibernate

    - by GigaPr
    Hi i am trying to learn Java, Hibernate and the MVC pattern. Following various tutorial online i managed to map my database, i have created few Main methods to test it and it works. Furthermore i have created few pages using the MVC patter and i am able to display some mock data as well in a view. the problem is i can not connect the two. this is what i have My view Looks like this <%@ include file="/WEB-INF/jsp/include.jsp" %> <html> <head> <title>Users</title> <%@ include file="/WEB-INF/jsp/head.jsp" %> </head> <body> <%@ include file="/WEB-INF/jsp/header.jsp" %> <img src="images/rss.png" alt="Rss Feed"/> <%@ include file="/WEB-INF/jsp/menu.jsp" %> <div class="ContainerIntroText"> <img src="images/usersList.png" class="marginL150px" alt="Add New User"/> <br/> <br/> <div class="usersList"> <div class="listHeaders"> <div class="headerBox"> <strong>FirstName</strong> </div> <div class="headerBox"> <strong>LastName</strong> </div> <div class="headerBox"> <strong>Username</strong> </div> <div class="headerAction"> <strong>Edit</strong> </div> <div class="headerAction"> <strong>Delete</strong> </div> </div> <br><br> <c:forEach items="${users}" var="user"> <div class="listElement"> <c:out value="${user.firstName}"/> </div> <div class="listElement"> <c:out value="${user.lastName}"/> </div> <div class="listElement"> <c:out value="${user.username}"/> </div> <div class="listElementAction"> <input type="button" name="Edit" title="Edit" value="Edit"/> </div> <div class="listElementAction"> <input type="image" src="images/delete.png" name="image" alt="Delete" > </div> <br /> </c:forEach> </div> </div> <a id="addUser" href="addUser.htm" title="Click to add a new user">&nbsp;</a> </body> </html> My controller public class UsersController implements Controller { private UserServiceImplementation userServiceImplementation; public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ModelAndView modelAndView = new ModelAndView("users"); List<User> users = this.userServiceImplementation.get(); modelAndView.addObject("users", users); return modelAndView; } public UserServiceImplementation getUserServiceImplementation() { return userServiceImplementation; } public void setUserServiceImplementation(UserServiceImplementation userServiceImplementation) { this.userServiceImplementation = userServiceImplementation; } } My servelet definitions <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <!-- the application context definition for the springapp DispatcherServlet --> <bean name="/home.htm" class="com.rssFeed.mvc.HomeController"/> <bean name="/rssFeeds.htm" class="com.rssFeed.mvc.RssFeedsController"/> <bean name="/addUser.htm" class="com.rssFeed.mvc.AddUserController"/> <bean name="/users.htm" class="com.rssFeed.mvc.UsersController"> <property name="userServiceImplementation" ref="userServiceImplementation"/> </bean> <bean id="userServiceImplementation" class="com.rssFeed.ServiceImplementation.UserServiceImplementation"> <property name="users"> <list> <ref bean="user1"/> <ref bean="user2"/> </list> </property> </bean> <bean id="user1" class="com.rssFeed.domain.User"> <property name="firstName" value="firstName1"/> <property name="lastName" value="lastName1"/> <property name="username" value="username1"/> <property name="password" value="password1"/> </bean> <bean id="user2" class="com.rssFeed.domain.User"> <property name="firstName" value="firstName2"/> <property name="lastName" value="lastName2"/> <property name="username" value="username2"/> <property name="password" value="password2"/> </bean> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property> <property name="prefix" value="/WEB-INF/jsp/"></property> <property name="suffix" value=".jsp"></property> </bean> </beans> and finally this class to access the database public class HibernateUserDao extends HibernateDaoSupport implements UserDao { public void addUser(User user) { getHibernateTemplate().saveOrUpdate(user); } public List<User> get() { User user1 = new User(); user1.setFirstName("FirstName"); user1.setLastName("LastName"); user1.setUsername("Username"); user1.setPassword("Password"); List<User> users = new LinkedList<User>(); users.add(user1); return users; } public User get(int id) { throw new UnsupportedOperationException("Not supported yet."); } public User get(String username) { return null; } } the database connection occurs in this file <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="org.hsqldb.jdbcDriver"/> <property name="url" value="jdbc:hsqldb:hsql://localhost/rss"/> <property name="username" value="sa"/> <property name="password" value=""/> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" > <property name="dataSource" ref="dataSource" /> <property name="mappingResources"> <list> <value>com/rssFeed/domain/User.hbm.xml</value> </list> </property> <property name="hibernateProperties" > <props> <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop> </props> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="userDao" class="com.rssFeed.dao.hibernate.HibernateUserDao"> <property name="sessionFactory" ref="sessionFactory"/> </bean> </beans> Could you help me to solve this problem i spent the last 4 days and nights on this issue without any success Thanks

    Read the article

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

    - by nag
    I have two entitys MobeeCustomer and CustomerRegion i want to remove the object from CustomerRegion first Im put join Coloumn in CustomerRegion is null then Remove the Object from the entityManager but Iam getting Exception MobeeCustomer: public class MobeeCustomer implements Serialization{ private Long id; private String custName; private String Address; private String phoneNo; private Set<CustomerRegion> customerRegion = new HashSet<CustomerRegion>(0); @OneToMany(cascade = { CascadeType.PERSIST, CascadeType.REMOVE }, fetch = FetchType.LAZY, mappedBy = "mobeeCustomer") public Set<CustomerRegion> getCustomerRegion() { return CustomerRegion; } public void setCustomerRegion(Set<CustomerRegion> customerRegion) { CustomerRegion = customerRegion; } } CustomerRegion public class CustomerRegion implements Serializable{ private Long id; private String custName; private String description; private String createdBy; private Date createdOn; private String updatedBy; private Date updatedOn; private MobeeCustomer mobeeCustomer; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "MOBEE_CUSTOMER") public MobeeCustomer getMobeeCustomer() { return mobeeCustomer; } public void setMobeeCustomer(MobeeCustomer mobeeCustomer) { this.mobeeCustomer = mobeeCustomer; } } sample code: for (CustomerRegion region : deletedRegionList) { region.setMobeeCustomer(null); getEntityManager().remove(region); } StackTrace: please suggest me how to remove the CustomerRegion Object I am getting Exception javax.persistence.EntityNotFoundException: deleted entity passed to persist: [com.manam.mobee.persist.entity.CustomerRegion#<null>] 15:46:34,614 ERROR [STDERR] at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:613) 15:46:34,614 ERROR [STDERR] at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:299) 15:46:34,614 ERROR [STDERR] at org.jboss.seam.persistence.EntityManagerProxy.flush(EntityManagerProxy.java:92) 15:46:34,614 ERROR [STDERR] at org.jboss.seam.framework.EntityHome.update(EntityHome.java:64)

    Read the article

  • Saving tree-structures in Databases

    - by Nina Null
    Hello everyone. I use Hibernate/Spring and a MySQL Database for my data management. Currently I display a tree-structure in a JTable. A tree can have several branches, in turn a branch can have several branches (up to nine levels) again, or having leaves. Lately I have performanceproblemes, as soon as I want to create new branches on deeper levels. At this time a branch has a foreign key to its parent. The domainobject has access to its parent by calling getParent(), which returns the parent-branch. The deeper the level, the longer it takes to create a new branch. Microbenchmark results for creating a new branch are like: Level 1: 32 ms. Level 3: 80 ms. Level 9: 232 ms. Obviously the level (which means the number of parents) is responsible for this. So I wanted to ask, if there are any appendages to work around this kind of problem. I don’t understand why Hibernate needs to know about the whole object tree (all parents until the root) while creating a new branch. But as far as I know this can be the only reason for the delay while creating a new branch, because a branch doesn’t have any other relations to any other objects. I would be very thankful for any workarounds or suggestions. greets, jambusa

    Read the article

  • Dealing with SQLException with spring,hibernate & Postgres

    - by mad
    Hi im working on a project using HibernateDaoSUpport from my Daos from Spring & spring-ws & hibernate & postgres who will be used in a national application (means a lot of users) Actually, every exception from hibernate is automatically transformed into some specific Spring dataAccesException. I have a table with a keyword on the dabatase & a unique constraint on the keywords : no duplicate keywords is allowed. I have found twows ways to deal with with that in the Insert Dao: 1- Check for the duplicate manually (with a select) prior to doing your insert. I means that the spring transaction will have a SERIALIZABLE isolation level. The obvious drawback is that we have now 2 queries for a simple insert.Advantage: independent of the database 2-let the insert gone & catch the SqlException & convert it to a userfriendly message & errorcode to the final consumer of our webservices. Solution 2: Spring has developped a way to translate specific exeptions into customized exceptions. see http://www.oracle.com/technology/pub/articles/marx_spring.html In my case i would have a ConstraintViolationException. Ideally i would like to write a custom SQLExceptionTranslator to map the duplicate word constraint in the database with a DuplicateWordException. But i can have many unique constraints on the same table. So i have to get the message of the SQLEXceptions in order to find the name of the constraint declared in the create table "uq_duplicate-constraint" for example. Now i have a strong dependency with the database. Thanks in advance for your answers & excuse me for my poor english (it is not my mother tongue)

    Read the article

  • how to use a list containing the query result with hibernate and display it in jsp

    - by kawtousse
    hi everyone, In my servlet I construct the query like the following: net.sf.hibernate.Session s = null; net.sf.hibernate.Transaction tx; try { s= HibernateUtil.currentSession(); tx=s.beginTransaction(); Query query = s.createQuery("select opcemployees.Nom,opcemployees.Prenom,dailytimesheet.TrackingDate,dailytimesheet.Activity," + "dailytimesheet.ProjectCode,dailytimesheet.WAName,dailytimesheet.TaskCode," + "dailytimesheet.TimeSpent,dailytimesheet.PercentTaskComplete from Opcemployees opcemployees,Dailytimesheet dailytimesheet " + "where opcemployees.Matricule=dailytimesheet.Matricule and dailytimesheet.Etat=3 " + "group by opcemployees.Nom,opcemployees.Prenom" ); List opdts= query.list(); request.setAttribute("items", opdts); request.getRequestDispatcher("EspaceValidation.jsp").forward(request, response); } catch (HibernateException e){ e.printStackTrace();} But in the jsp I can't display the result correctly. I do the following in JSP: <table> <c:forEach items="${items}" var="item"> <tr> <td>${item}</td> </tr> </c:forEach> </table> thanks for help.

    Read the article

  • Lost in dates and timezones

    - by Sebastien
    I'm working on an application that stores conferences with their start and end date. Up until now, I was developing in Belgium and my server is in France, so everything is in the same timezone, no problem. But today, I'm in San Francisco, my server is in France and I noticed I have a bug. I'm setting dates from a Flex client (ActionScript automatically adapts date display according to client local timezone, which is GMT-8 for me today. My server runs on Hibernate and MySQL in France (GMT+1). So when I look at my database using phpMyAdmin, I see a date set to "2010-06-07 00:00:01" but in my Flex client it displays "2010-06-06 15:00:01". Ultimately, what I want is that the dates are displayed in the local timezone of the event, which is the date I set it to. So when I'm in Belgium and I set the start date of an event to be "2010-06-07 00:00:01" I want to retrieve it that way. But I'm lost as to what layer adapts what. Is timezone stored in DATETIME MySQL columns (I can't see it in MySQL)? Does Hibernate to anything to it when it transfers it to java.lang.Date that has Timezone information? And ultimately, what is the best way to solve this mess?

    Read the article

  • Retrieve only the superclass from a class hierarchy

    - by user1792724
    I have an scenario as the following: @Entity @Table(name = "ANIMAL") @Inheritance(strategy = InheritanceType.JOINED) public class Animal implements Serializable { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "S_ANIMAL") @SequenceGenerator(name = "S_ANIMAL", sequenceName = "S_ANIMAL", allocationSize = 1) public int getNumero() { return numero; } public void setNumero(int numero) { this.numero = numero; } . . . } and as the subclass: @Entity @Table(name = "DOG") public class Dog extends Animal { private static final long serialVersionUID = -7341592543130659641L; . . . } I have a JPA Select statement like this: SELECT a FROM Animal a; I'm using Hibernate 3.3.1 As I can see the framework retrieves instances of Animal and also of Dog using a left outer join. Is there a way to Select only the "part" Animal? I mean, the previous Select will get all the Animals, those that are only Animals but not Dogs and those that are Dogs. I want them all, but in the case of Dogs I want to only retrieve the "Animal part" of them. I found the @org.hibernate.annotations.Entity(polymorphism = PolymorphismType.EXPLICIT) but as I could see this only works if Animal isn't an @Entity. Thanks a lot.

    Read the article

  • Long running method causing race condition

    - by keeleyt83
    Hi, I'm relatively new with hibernate so please be gentle. I'm having an issue with a long running method (~2 min long) and changing the value of a status field on an object stored in the DB. The pseudo-code below should help explain my issue. public foo(thing) { if (thing.getStatus() == "ready") { thing.setStatus("finished"); doSomethingAndTakeALongTime(); } else { // Thing already has a status of finished. Send the user back a message. } } The pseudo-code shouldn't take much explanation. I want doSomethingAndTakeALongTime() to run, but only if it has a status of "ready". My issue arises whenever it takes 2 minutes for doSomethingAndTakeALongTime() to finish and the change to thing's status field doesn't get persisted to the database until it leaves foo(). So another user can put in a request during those 2 minutes and the if statement will evaluate to true. I've already tried updating the field and flushing the session manually, but it didn't seem to work. I'm not sure what to do from here and would appreciate any help. PS: My hibernate session is managed by spring.

    Read the article

  • Using Java classes(whole module with Spring/Hibernate dependency) in Grails

    - by Sitaram
    I have a Java/Spring/Hibernate application with a payment module. Payment module has some domain classes for payment subscription and transactions etc. Corresponding hibernate mapping files are there. This module uses applicationContext.xml for some of the configuration it needs. Also, This module has a PaymentService which uses a paymentDAO to do all database related work. Now, I want to use this module as it is(without any or minimal re-writing) in my other application(Grails application). I want to bring in the payment module as a jar or copy the source files to src/java folder in Grails. With that background, I have following queries: Will the existing applicationContext.xml for Spring configuration in the module will work as it is in Grails? Does it merge with rest of Grails's Spring config? Where do I put the applicationContext.xml? classpath? src/java should work? Can I bundle the applicationContext.xml in Jar(If I use jar option) and can overwrite in Grails if anything needs to be changed? Multiple bean definition problems in that case? PaymentService recognized as regular service? Will it be auto-injected in controllers and/or other services? Will PaymentDAO use the datasource configuration of Grails? Where do I put the hbm files of this module? Can I bundle the hbm files in Jar(If I use jar option) and can overwrite in Grails if anything needs to be changed? Which hbms are picked? or, there will be problems with that? Too many questions! :) All these concerns are actually before trying. I am going to try this in next few days(busy currently). Any help is appreciated. Thanks. Sitaram Meena

    Read the article

  • problem with "select new Object ... join ... where"

    - by jacob
    Hi, I'm having a problem with an HQL query Three classes ClassOne is my BusinessObject public class ClassOne { private int id; private int status; private Set<ClassTwo> classTwos; + other fields/getters/setters/constructor etc } ClassTwo is referenced in a set of ClassOne and is kind of the history of an object of ClassOne public class ClassTwo { private int id; private int oldStatus; private int newStatus; private String message; //+ getters/setters/constructor etc } ClassThree is my DTO/VO with just one classTwo (not the whole history) public class ClassThree { private int id; private int status; private ClassTwo classTwo; public ClassThree(int pId, int pStatus, ClassTwo pClassTwo) { id=pId; status=pStatus; classTwo=pClassTwo; } //+ getters/setters etc } Now I'd like to create an HQL query like this: I'd like to get all objects of ClassThree with a certain status and if it exists the newest ClassTwo with a certain newStatus. For example: I'd like to get all the DTOs (ClassThree) of ClassOne whose status is now 1, but earlier in their history it has been 2 and I'd like to have the latest ClassTwo object which has 2 as newStatus. SELECT new ClassThree(c1.id, c1.status, c2) FROM ClassOne c1 LEFT JOIN c1.classtwos c2 (...) and (...) is where I don't know what to do, I'm not even sure if it's a join / join fetch Looked around and tried quite a lot already, but no clue. Especially with the join fetch I get some Hibernate errors like org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list. Fetching the BusinessObject like that is no problem SELECT distinct(c1) FROM ClassOne c1 LEFT OUTER JOIN FETCH c1.classtwos c2 and I get the ClassTwos as my field. Thanks in advance, Jacob P.S.: One thing might be important, ClassTwo has no reference to ClassOne!!

    Read the article

  • Java Generics error when implementing Hibernate message interpolator

    - by Jayaprakash
    Framework: Spring, Hibernate. O/S: Windows I am trying to implement hibernate's Custom message interpolator following the direction of this Link. When implementing the below class, it gives an error "Cannot make a static reference to the non-static type Locale". public class ClientLocaleThreadLocal<Locale> { private static ThreadLocal tLocal = new ThreadLocal(); public static void set(Locale locale) { tLocal.set(locale); } public static Locale get() { return tLocal.get(); } public static void remove() { tLocal.remove(); } } As I do not know generics enough, not sure how is being used by TimeFilter class below and the purpose of definition in the above class. public class TimerFilter implements Filter { public void destroy() { } public void doFilter(ServletRequest req, ServletResponse res, FilterChain filterChain) throws IOException, ServletException { try { ClientLocaleThreadLocal.set(req.getLocale()); filterChain.doFilter(req, res); }finally { ClientLocaleThreadLocal.remove(); } } public void init(FilterConfig arg0) throws ServletException { } } Will doing the following be okay? Change static method/field in ClientLocaleThreadLocal to non-static method/fields In TimeFilter, set locale by instantiating new object as below. new ClientLocaleThreadLocal().set(req.getLocale()) Thanks for your help in advance

    Read the article

< Previous Page | 136 137 138 139 140 141 142 143 144 145 146 147  | Next Page >