Search Results

Search found 1098 results on 44 pages for 'persistence'.

Page 28/44 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • Bad value for type timestamp on production server

    - by Juan Javaloyes
    I'm working with: seam 2.2.2 + hibernate + richfaces + jboss 5.1 + postgres I have an module which needs to load some data from the database. Easy. The problem is, on development it works fine, 100%, but when I deploy on my production server and try to get the data, an error rise: could not read column value from result set: fechahor9_504_; Bad value for type timestamp : [C@122e5cf SQL Error: 0, SQLState: 22007 Bad value for type timestamp : [C@122e5cf javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not execute query [more errors] Caused by: org.postgresql.util.PSQLException: Bad value for type timestamp : [C@122e5cf at org.postgresql.jdbc2.TimestampUtils.loadCalendar(TimestampUtils.java:232) [more errors] Caused by: java.lang.NumberFormatException: Trailing junk on timestamp: '' at org.postgresql.jdbc2.TimestampUtils.loadCalendar(TimestampUtils.java:226) I can't understand why it works on my machine (development) and why not on production. Any clues? Anyone gone through the same problem? Is exactly the same compilation

    Read the article

  • iPhone: How to Get Basic Authentication to HTTPS Web Service Using NSURLCredential

    - by ian1971
    I am trying to call an https web service (RESTful) using basic authentication. It works fine if I put the credentials in the url itself but I would rather add it to the request so that the password does not appear, for instance in an exception. I am using the following code: NSURLCredential *credential = [NSURLCredential credentialWithUser:@"myuser" password:@"mypassword" persistence:NSURLCredentialPersistenceForSession]; NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc] initWithHost:@"example.com" port:443 protocol:@"https" realm:nil authenticationMethod:NSURLAuthenticationMethodHTTPBasic]; [[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credential forProtectionSpace:protectionSpace]; NSURLConnection *theConnection = [NSURLConnection connectionWithRequest:theRequest delegate:self]; but it does not work. The didReceiveAuthenticationChallenge delegate method gets called and I can add a credential there but ideally I would send it with the request. Any ideas?

    Read the article

  • How to do a timestamp comparison with JPA query?

    - by Robert
    We need to make sure only results within the last 30 days are returned for a JPQL query. An example follows: Date now = new Date(); Timestamp thirtyDaysAgo = new Timestamp(now.getTime() - 86400000*30); Query query = em.createQuery( "SELECT msg FROM Message msg "+ "WHERE msg.targetTime < CURRENT_TIMESTAMP AND msg.targetTime > {ts, '"+thirtyDaysAgo+"'}"); List result = query.getResultList(); Here is the error we receive: <openjpa-1.2.3-SNAPSHOT-r422266:907835 nonfatal user error org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter 'SELECT msg FROM BroadcastMessage msg WHERE msg.targetTime < CURRENT_TIMESTAMP AND msg.targetTime {ts, '2010-04-18 04:15:37.827'}'. Error message: org.apache.openjpa.kernel.jpql.TokenMgrError: Lexical error at line 1, column 217. Encountered: "{" (123), after : "" Help!

    Read the article

  • Delphi 2010 Professional and remote database access

    - by Kico Lobo
    Hi, When looking for which version of Delphi 2010 to buy, we found the following limitation on the professional one: Delphi 2010 Professional is designed for developers building high-performance desktop GUI and touch-screen applications with (or without) embedded and local database persistence. What does this really mean? Does this mean that we'll only face this restriction if we choose to use the native vcl components for database access we'll face this restriction. And what if we choose to use ADO components instead of those? In this case, how can Delphi avoid us to access remote database servers? Did anyone here ever tried this? Going even further: if we choose to use a database like Firebird, which is just one file, and used a network mapped drive. Could we be facing the same limitation? Supposing we opt for ADO, what will be the main consequences?

    Read the article

  • In JPA 2, using a CriteriaQuery, how to count results

    - by seanizer
    I am rather new to JPA 2 and it's CriteriaBuilder / CriteriaQuery API: http://java.sun.com/javaee/6/docs/api/javax/persistence/criteria/CriteriaQuery.html http://java.sun.com/javaee/6/docs/tutorial/doc/gjivm.html I would like to count the results of a CriteriaQuery without actually retrieving them. Is that possible, I did not find any such method, the only way would be to do this: CriteriaBuilder cb = entityManager.getCriteriaBuilder(); CriteriaQuery<MyEntity> cq = cb .createQuery(MyEntityclass); // initialize predicates here return entityManager.createQuery(cq).getResultList().size(); And that can't be the proper way to do it... Is there a solution?

    Read the article

  • JPQL get most recent rows

    - by Vinnie
    Let's say I have the following tables my_profile_data ------------- integer: profile_id date: date_changed string: value my_profile ------------- integer: profile_id string: name I want to get the most recent profile information. In plain SQL this would look something like: select mpd.profile_id, mpd.value, max(mpd.date_changed) from my_profile_data mpd, my_profile mp where mpd.profile_id = mp.profile_id and mp.name='The Profile I Want' group by mpd.profile_id I've tried different variants of the following JPQL query, but cant get it to work. SELECT mpd FROM MyProfileData mpd LEFT JOIN (SELECT mpd.profileId profileId, MAX(mpd.dateChanged) FROM MyProfileData mpd LEFT JOIN mp.profile WHERE mp.name = :name GROUP BY mpd.profileId) recent ON (rp.profileid = recent.profileId) Is this query doable in JPA? I'm using EclipseLink as my JPA provider. The innermost exception I get when I try to run this is Caused by: NoViableAltException(81!=[506:7: (n= joinAssociationPathExpression ( AS )? i= IDENT | t= FETCH n= joinAssociationPathExpression )]) at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.join(JPQLParser.java:3669) ... 73 more

    Read the article

  • Is it possible to reset NSURLConnection after providing credentials?

    - by John
    I am calling a REST service that requires basic auth and I respond to the didReceiveAuthenticationChallenge delegate OK NSURLCredential *credential = [[NSURLCredential alloc] initWithUser:self.user password:self.password persistence:NSURLCredentialPersistenceForSession]; [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge]; [credential release]; The Credentials are valid for the Session but I would like for my App to be able to switch between servers and therefore need to "reset" the Session so it asks again for a challenge. I can of course try the option of not storing the credentials for the Session and supply them for each call but this does not seem like a good idea. Any ideas would be appreciated!

    Read the article

  • What does transaction.commit() do when the flushmode is set manual in Hibernate?

    - by wei
    Here is a block of code in the Java Persistence with Hibernate book by Christian and Gavin, Session session = getSessionFactory().openSession(); session.setFlushMode(FlushMode.MANUAL); // First step in the conversation session.beginTransaction(); Item item = (Item) session.get(Item.class, new Long(123) ); session.getTransaction().commit(); // Second step in the conversation session.beginTransaction(); Item newItem = new Item(); Long newId = (Long) session.save(newItem); // Triggers INSERT! session.getTransaction().commit(); // Roll back the conversation! session.close();//enter code here I am confused that why the first step and second step need to be wrapped into two separate transactions? Since the flushmode is set manual here, no operations (suppose we ignore the insert here) will hit the database anyway. So why bother with transactions here? thanks

    Read the article

  • Is there a complete working example of a unit tested JPA2/CDI/JSF2 WebApp without EJBs ?

    - by Maxime ARNSTAMM
    Hello everyone, I want to build a web app in JPA2/CDI (without EJBs) and i get how to code the different beans (i worked for some time on seam/jpa apps), but i'm stuck because i can't find a complete working set of configuration files (ie : persistence.xmln web.xml and stuff), and there is always a little glitch or something i miss. My goal is to develop a simple CRUD (1 or 2 pages) but unit tested, for future use, as a code base. So if you already did this kind of mini project, or if you know where i can find a working example, that would be great if you could help me. Thanks

    Read the article

  • sharp architecture mapping error

    - by fez
    this is the error when i load product entity my code is Configuration cfg = new NHibernate.Cfg.Configuration(); ISessionFactory sessions; public MedicineController() //Construtor { cfg.Configure(); sessions = cfg.BuildSessionFactory(); } using (var session = sessions.OpenSession()) { var pGet = session.Get<Product>(0); } The Error is Unable to locate persister for the entity named 'SharpArchitecture.Domain.Product'. The persister define the persistence strategy for an entity. Possible causes: - The mapping for 'SharpArchitecture.Domain.Product' was not added to the NHibernate configuration. Thanks in advance

    Read the article

  • SQL Anywhere 11, JZ0C0: Connection is already closed

    - by Alex
    SLOVED see commend I develop am webservice based on apache tomcat 6.0.26, apache cxf 2.2.7, spring 3.0, hibernate 3.3 and sybase sqlanywhere 11. im using the latest JDBC Driver from SYBASE jconn.jar Version 6. The persistence layer is based on spring + hibernate dao, the connection is configured via a JNDI datasoure (META-INF directory). It seems that, during longer times of inactivity, the connection from the webservice to the database is closed. Exception: java.sql.SQLException: JZ0C0: Connection is already closed. Best regards, Alex

    Read the article

  • Tips for resolving Hibernate/JPA EntityNotFoundException

    - by Damo
    I'm running into a problem with Hibernate where when trying to delete a group of Entities I encounter the following error: javax.persistence.EntityNotFoundException: deleted entity passed to persist: [com.locuslive.odyssey.entity.FreightInvoiceLine#<null>] These are not normally so difficult to track down as they are usually caused by an entity being deleted but not being removed from a Collection that it is a member of. In this case I have removed the entity from every list that I can think of (it's a complex datamodel). I've put JBoss logging into Trace and I can see the collections that are being cascaded. However I can't seem to find the Collection containing the entity that I'm deleting. Does anyone have any tips for resolving this particular Exception? Thanks.

    Read the article

  • ORA-22835 using JPA (Buffer too small)

    - by Kenneth
    I am trying to persist an Entity with a @Lob annotated String field. The content of that fiels if bigger than the 40k buffer size limit. The first problem I had was related to the setString method used internally by the JPA implementation (Hibernate in my case) and the Oracle JDBC Driver. This problem was solved adding <property name="hibernate.connection.SetBigStringTryClob" value="true"/> to my persistence.xml file. Then, the error changed to a ORA-22835 error (the buffer is too small). ¿Is there any way that JPA solves this problem without going to a low-level implementation? ¿Any suggestions?

    Read the article

  • "detached entity passed to persist error" with JPA/EJB code

    - by zengr
    I am trying to run this basic JPA/EJB code: public static void main(String[] args){ UserBean user = new UserBean(); user.setId(1); user.setUserName("name1"); user.setPassword("passwd1"); em.persist(user); } I get this error: javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: com.JPA.Database Any ideas? I search on the internet and the reason I found was: This was caused by how you created the objects, i.e. If you set the ID property explicitly. Removing ID assignment fixed it. But I didn't get it, what will I have to modify to get the code working?

    Read the article

  • What are your thoughts on Raven DB?

    - by Ronnie Overby
    What are your thoughts on Raven DB? I see this below my title: The question you're asking appears subjective and is likely to be closed. Please don't do that. I think the question is legit because: Raven DB is brand-spanking-new. RDBMS's are probably the de facto for data persistence for .net developers, which Raven DB is not. Given these points, I would like to know your general opinions. Admittedly, the question is sort of broad. That is intentional, because I am trying to learn as much about it as possible, however here are some of my initial concerns and questions: What about using Raven DB for data storage in a shared web hosting environment, since Raven DB is interacted with through HTTP? Are there any areas that Raven DB is particularly well or not well suited for? How does it rank among alternatives, from a .net developer's perspective?

    Read the article

  • Any competitors to db4o on compact framework?

    - by MrJeepster
    We've been trying db4o for persisting objects on the compact framework. It works very well from our tests so far. However, it appears they are on the expensive side for small startups with minimal units needed. Does anyone know of any similar object databases for the compact framework? How about a open source one that is free for commercial use? :) Thank you. EDIT: We're really looking for an object database. We don't want to create our own persistence framework at this point and would prefer being able to just save/retrieve the actual object trees.

    Read the article

  • Datanucleus/JDO Level 2 Cache on Google App Engine

    - by Thilo
    Is it possible (and does it make sense) to use the JDO Level 2 Cache for the Google App Engine Datastore? First of all, why is there no documentation about this on Google's pages? Are there some problems with it? Do we need to set up limits to protect our memcache quota? According to DataNucleus on Stackoverflow, you can set the following persistence properties: datanucleus.cache.level2.type=javax.cache datanucleus.cache.level2.cacheName={cache name} Is that all? Can we choose any cache name? Other sources on the Internet report using different settings. Also, it seems we need to download the DataNucleus Cache support plugin. Which version would be appropriate? And do we just place it in WEB-INF/lib or does it need more setup to activate it?

    Read the article

  • App engine datastore - query on Enum fields.

    - by Gopi
    I am using GAE(Java) with JDO for persistence. I have an entity with a Enum field which is marked as @Persistent and gets saved correctly into the datastore (As observed from the Datastore viewer in Development Console). But when I query these entities putting a filter based on the Enum value, it is always returning me all the entities whatever value I specify for the enum field. I know GAE java supports enums being persisted just like basic datatypes. But does it also allow retrieving/querying based on them? Google search could not point me to any such example code. Details: I have printed the Query just before being executed. So in two cases the query looks like - SELECT FROM com.xxx.yyy.User WHERE role == super ORDER BY key desc RANGE 0,50 SELECT FROM com.xxx.yyy.User WHERE role == admin ORDER BY key desc RANGE 0,50 Both above queries return me all the User entities from datastore in spite of datastore viewer showing some Users are of type 'admin' and some are of type 'super'.

    Read the article

  • Hibernate @OneToOne @NotNull

    - by Marty Pitt
    Is it valid to declare @OneToOne and @NotNull on both sides of a relationship, such as: class ChangeEntry { @OneToOne(cascade=CascadeType.ALL) @NotNull ChangeEntryDetails changeEntryDetails; } class ChangeEntryDetails { @OneToOne(cascase=CascadeType.ALL) @NotNull ChangeEntry changeEntry; } I can't find anything that says this is invalid, but it seems that during persistence at least one side of the relationship must be violated. (Eg., if writing changeEntry first, changeEntryDetails will be null temporarily). When trying this, I see an exception thrown not-null property references a null or transient value. I'd like to avoid relaxing the constraint if possible, because both sides must be present.

    Read the article

  • DefaultSchedulerService in ASP.NET application

    - by Samir P
    Hi, My project has a requirement to implement look-ahead caching i.e. triggering another request on invokation of a specific request. The following details in short the implementation - HttpModule parses the SOAPRequest and matches entry in a configuration file for look-ahead candidate. If the request matches, it prepares the Parameters dictionary and starts appropriate workflow. Single workflow runtime is used across all requests is ensured through initializing the runtime instance at Application_Start event and stored in Application Dictionary. Using persistence service and DefaultScheduler service. We can't implement windows service model, as current requirement mandates passing the SOAPRequest parameters as arguments. ManualSchedulerService is not in contention due to synchronous nature of it's actual behaviour. Still the performance is pretty bad and product team is not happy. Can anybody suggest me better solution? Thanks, Samir

    Read the article

  • TypeInitializationException When Getting an NHibernate Session

    - by Paul Johnson
    I’ve run into what appears to be an NHibernate config problem. Basically, I ran up a simple proof of concept persistence integration test using NUnit, the test simply querys an Oracle database and successfully returns the last record received by the underlying table. However, when the assemblies are taken out of the NUnit test environment and deployed as they would be for an actual application build, my call for an NHibernate session results in a ‘TypeInitializationException’ whilst executing the code line: sessionFactory = New Configuration().Configure().BuildSessionFactory() The application is a vb.net console app running against an Oracle 9.2 database, using a ‘coding framework’ published on the web by Bill McCafferty entitled 'NHibernate Best Practices with ASP.NET' (pre S#harp Architecture). I am running version 2.1.2.4000 of NHibernate. Any assistance much appreciated. Kind Regards Paul J.

    Read the article

  • How to get hold of the current NHibernate.Cfg.Configuration instance.

    - by Sandor Drieënhuizen
    My C# project has repositories that are instantiated using dependency injection. One of the repository methods needs access to the NHibernate.Cfg.Configuration instance (to generate the database schema) that was returned when initializing NHibernate. I cannot pass the configuration to the repository however, because that would break the persistence ignorance principle -- I really don't want to expose any implementation details through the repository interface. So what I'm looking for is a way of getting hold of the current NHibernate.Cfg.Configuration instance from within my repository. I have no trouble getting hold of the current session, it's just the configuration that I cannot get hold of.

    Read the article

  • Eclipse plugins for Spring / Hibernate development?

    - by es11
    I have a running dynamic web project in Eclipse (Java EE + Maven + Spring). I am at the point where I need to integrate a persistence layer and want to use Hibernate with a mySql database. I am wonder what plugins would be useful for me at this point? For Hibernate should I install hibernate tools or is it not necessary? Are then any plugins that are most widely use for connecting / exploring database connections that would be appropriate for the type of project I am working on? Thanks.

    Read the article

  • How to secure Java webservices with login and session handling

    - by hubertg
    I'd like to secure my (Java metro) webservice with a login. Here's how I'm planning to do that: Steps required when calling a webservice method are: call login(user,pwd), receive a session token 1.1 remember the token call servicemethod (token, arg1, arg2...) webservice checks if the token is known, if not throw exception otherwise proceed logout or timeout after x time periods of inactivity my questions: 1. what's your opinion on this approach? does it make sense? 2. are there any libraries which take the burden of writing a session handling (maybe with database persistence to survive app restarts) (the solution should be simple and easily usable with Java and .NET clients) thanks!

    Read the article

  • Java - JPA - When we need more than one EntityManager?

    - by Yatendra Goel
    I am learning JPA and have one question: In which situations we need more than one EntityManager in our application? The two situations that I am aware of are as follows: When our application is a multi-threaded application and more than one thread needs JPA transaction because EntityManager is not thread-safe and we need one EntityManager per thread. When any of the thread needs multiple concurrent transactions, we need more than one EntityManager in that thread because there is one-to-one relationship between EntityManager and EntityTransaction. Q1. Are there any other situations when we need more than one EntityManager? ================================================================================= Q2. Upto my understanding, there should be only one EntityManagerFactory per Persitence Unit. Am I correct? If not, then what are those situations when we need multiple EntityManagerFactory per Persistence Unit?

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >