Search Results

Search found 1291 results on 52 pages for 'persistence ignorance'.

Page 5/52 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • RabbitMQ and persistence (blocking writes?)

    - by daharon
    I want to create a RabbitMQ server on a virtual machine (VMware) to be used in production. It will contain persistent queues. I'm wondering if it is a bad idea to store the server on a NAS that's accessed over NFS. Basically my questions are: Will RabbitMQ's writes be blocking? Will the entire queue's operation halt on a write? How much performance degradation should I expect when persisting over NFS?

    Read the article

  • Amazon EBS root volume persistence

    - by hipplar
    When I launch a new Windows EC2 instance I am given a 30 gig root EBS volume. I'm trying to make sure I understand the EBS terminology and want to make sure I understand this correctly: Q: What happens to my data when a system terminates? The data stored on a local instance store will persist only as long as that instance is alive. However, data that is stored on an Amazon EBS volume will persist independently of the life of the instance. What exactly does "instance is alive" mean? If I write files to the root volume and reboot the instance will the files remain? Or do I physically have to terminate (delete) the instance for the root volume to go away? Thanks

    Read the article

  • EC2 persistence of machine

    - by Seagull
    I notice that EBS-backed AMIs are much like a VMWare instances -- I can stop them and also persist them to disk, and all this is done relatively quickly. However, I believe that S3 backed machines are different. They cannot be 'stopped', but rather can only be shut-down, written to S3 disk and started up again; with at least a 15 min delay in doing so. Why the difference? How do AMI providers decide whether to use EBS or S3? If I need to stop/persist/restart machines relatively frequently, then I am implicitly limited to just the EBS-backed machines?

    Read the article

  • Mount --bind persistence over reboot

    - by vnuk
    I'm having trouble finding an answer for this question Does mount --bind persist over reboot? On my CentOS it looks like it doesn't, so I've placed apropriate mount --bind calls in rc.local. How can I do mount --bind to avoid rc.local scenario?

    Read the article

  • Session persistence between multiple Rails / Unicorn servers with Redis as session_store on AWS

    - by d_ethier
    I've got 2 nginx EC2 instances pointing to 2 Unicorn EC2 instances in a round robin load balanced configuration. The two nginx instances are being the Elastic Load Balancer. Both Unicorn instances have a Redis session_store configured which is in a master/slave configuration with an Elastic IP attached to the master. I've tried configuring the session stickiness on the load balancer, but sessions are lost on each page refresh. I'm using the redis-store gem for the session_store configuration and redis support. Anyone have any ideas as to why this is not working?

    Read the article

  • java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z

    - by Panayiotis Karabassis
    I am getting this error: java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z These are the jars in my classpath: com.sun.faces/jsf-api/jars/jsf-api-2.0.0.jar com.sun.faces/jsf-impl/jars/jsf-impl-2.0.0.jar org.apache.myfaces.orchestra/myfaces-orchestra-core20/jars/myfaces-orchestra-core20-1.5-SNAPSHOT.jar commons-lang/commons-lang/jars/commons-lang-2.1.jar commons-logging/commons-logging/jars/commons-logging-1.1.1.jar org.springframework/spring/jars/spring-2.5.6.jar commons-el/commons-el/jars/commons-el-1.0.jar org.richfaces.ui/richfaces-ui/jars/richfaces-ui-3.3.3.Final.jar org.richfaces.framework/richfaces-api/jars/richfaces-api-3.3.3.Final.jar commons-collections/commons-collections/jars/commons-collections-3.2.jar commons-beanutils/commons-beanutils/jars/commons-beanutils-1.8.0.jar org.richfaces.framework/richfaces-impl-jsf2/jars/richfaces-impl-jsf2-3.3.3.Final.jar com.sun.facelets/jsf-facelets/jars/jsf-facelets-1.1.14.jar org.hibernate/hibernate-core/jars/hibernate-core-3.6.0.Final.jar antlr/antlr/jars/antlr-2.7.6.jar dom4j/dom4j/jars/dom4j-1.6.1.jar org.hibernate/hibernate-commons-annotations/jars/hibernate-commons-annotations-3.2.0.Final.jar org.slf4j/slf4j-api/jars/slf4j-api-1.6.1.jar org.hibernate.javax.persistence/hibernate-jpa-2.0-api/jars/hibernate-jpa-2.0-api-1.0.0.Final.jar javax.transaction/jta/jars/jta-1.1.jar org.hibernate/hibernate-c3p0/jars/hibernate-c3p0-3.6.0.Final.jar c3p0/c3p0/jars/c3p0-0.9.1.jar org.hibernate/hibernate-entitymanager/jars/hibernate-entitymanager-3.6.0.Final.jar cglib/cglib/jars/cglib-2.2.jar asm/asm/jars/asm-3.1.jar javassist/javassist/jars/javassist-3.12.0.GA.jar org.hibernate/hibernate-search/jars/hibernate-search-3.3.0.Final.jar org.hibernate/hibernate-search-analyzers/jars/hibernate-search-analyzers-3.3.0.Final.jar org.apache.lucene/lucene-core/jars/lucene-core-3.0.3.jar org.apache.lucene/lucene-analyzers/jars/lucene-analyzers-3.0.3.jar mysql/mysql-connector-java/jars/mysql-connector-java-5.1.13.jar com.ocpsoft/prettyfaces-jsf2/jars/prettyfaces-jsf2-3.0.1.jar commons-digester/commons-digester/jars/commons-digester-2.0.jar org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.6.1.jar log4j/log4j/bundles/log4j-1.2.16.jar xom/xom/jars/xom-1.2.5.jar xml-apis/xml-apis/jars/xml-apis-1.3.03.jar xerces/xercesImpl/jars/xercesImpl-2.8.0.jar xalan/xalan/jars/xalan-2.7.0.jar org.jboss.jsfunit/jboss-jsfunit-core/jars/jboss-jsfunit-core-1.3.0.Final.jar net.sourceforge.htmlunit/htmlunit/jars/htmlunit-2.8.jar xalan/xalan/jars/xalan-2.7.1.jar xalan/serializer/jars/serializer-2.7.1.jar xml-apis/xml-apis/jars/xml-apis-1.3.04.jar commons-collections/commons-collections/jars/commons-collections-3.2.1.jar commons-lang/commons-lang/jars/commons-lang-2.4.jar org.apache.httpcomponents/httpclient/jars/httpclient-4.0.1.jar org.apache.httpcomponents/httpcore/jars/httpcore-4.0.1.jar commons-codec/commons-codec/jars/commons-codec-1.4.jar org.apache.httpcomponents/httpmime/jars/httpmime-4.0.1.jar org.apache.james/apache-mime4j/jars/apache-mime4j-0.6.jar net.sourceforge.htmlunit/htmlunit-core-js/jars/htmlunit-core-js-2.8.jar xerces/xercesImpl/jars/xercesImpl-2.9.1.jar net.sourceforge.nekohtml/nekohtml/jars/nekohtml-1.9.14.jar net.sourceforge.cssparser/cssparser/jars/cssparser-0.9.5.jar org.w3c.css/sac/jars/sac-1.3.jar commons-io/commons-io/jars/commons-io-1.4.jar cactus/cactus/jars/cactus-13-1.7.1.jar cactus/cactus-ant/jars/cactus-ant-13-1.7.1.jar commons-httpclient/commons-httpclient/jars/commons-httpclient-2.0.2.jar junit/junit/jars/junit-3.8.1.jar aspectj/aspectjrt/jars/aspectjrt-1.2.1.jar cargo/cargo/jars/cargo-0.5.jar ant/ant/jars/ant-1.5.4.jar and this is my ivy.xml: <dependencies> <!-- JSF 2.0 RI --> <dependency org="com.sun.faces" name="jsf-api" rev="2.0.0"/> <dependency org="com.sun.faces" name="jsf-impl" rev="2.0.0"/> <!-- MyFaces Orchestra --> <dependency org="org.apache.myfaces.orchestra" name="myfaces-orchestra-core20" rev="1.5-SNAPSHOT"/> <dependency org="org.springframework" name="spring" rev="2.5.6"/> <dependency org="commons-el" name="commons-el" rev="1.0"/> <!-- RichFaces --> <dependency org="org.richfaces.ui" name="richfaces-ui" rev="3.3.3.Final"/> <dependency org="org.richfaces.framework" name="richfaces-impl-jsf2" rev="3.3.3.Final"/> <dependency org="com.sun.facelets" name="jsf-facelets" rev="1.1.14"/> <!-- Hibernate --> <dependency org="org.hibernate" name="hibernate-core" rev="3.6.0.Final"/> <dependency org="org.hibernate" name="hibernate-c3p0" rev="3.6.0.Final"/> <dependency org="org.hibernate" name="hibernate-entitymanager" rev="3.6.0.Final"/> <dependency org="org.hibernate" name="hibernate-search" rev="3.3.0.Final"/> <dependency org="mysql" name="mysql-connector-java" rev="5.1.13"/> <!-- PrettyFaces --> <dependency org="com.ocpsoft" name="prettyfaces-jsf2" rev="3.0.1"/> <!-- SLF4J --> <dependency org="org.slf4j" name="slf4j-api" rev="1.6.1"/> <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.6.1"/> <!-- XOM --> <dependency org="xom" name="xom" rev="1.2.5"/> <!-- JSF Unit --> <dependency org="org.jboss.jsfunit" name="jboss-jsfunit-core" rev="1.3.0.Final" conf="development"/> </dependencies> I am deploying to tomcat 6.0 Update After the answer below, I solved this by adding the following dependency to my ivy.xml: <dependency org="org.hibernate.javax.persistence" name="hibernate-jpa-2.0-api" rev="1.0.0.Final"/> then putting this jar above everything else under Eclipse's build order tab. I was using JRE/JDK 6.

    Read the article

  • java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z

    - by Panayiotis Karabassis
    I am getting this error: java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z These are the jars in my classpath: com.sun.faces/jsf-api/jars/jsf-api-2.0.0.jar com.sun.faces/jsf-impl/jars/jsf-impl-2.0.0.jar org.apache.myfaces.orchestra/myfaces-orchestra-core20/jars/myfaces-orchestra-core20-1.5-SNAPSHOT.jar commons-lang/commons-lang/jars/commons-lang-2.1.jar commons-logging/commons-logging/jars/commons-logging-1.1.1.jar org.springframework/spring/jars/spring-2.5.6.jar commons-el/commons-el/jars/commons-el-1.0.jar org.richfaces.ui/richfaces-ui/jars/richfaces-ui-3.3.3.Final.jar org.richfaces.framework/richfaces-api/jars/richfaces-api-3.3.3.Final.jar commons-collections/commons-collections/jars/commons-collections-3.2.jar commons-beanutils/commons-beanutils/jars/commons-beanutils-1.8.0.jar org.richfaces.framework/richfaces-impl-jsf2/jars/richfaces-impl-jsf2-3.3.3.Final.jar com.sun.facelets/jsf-facelets/jars/jsf-facelets-1.1.14.jar org.hibernate/hibernate-core/jars/hibernate-core-3.6.0.Final.jar antlr/antlr/jars/antlr-2.7.6.jar dom4j/dom4j/jars/dom4j-1.6.1.jar org.hibernate/hibernate-commons-annotations/jars/hibernate-commons-annotations-3.2.0.Final.jar org.slf4j/slf4j-api/jars/slf4j-api-1.6.1.jar org.hibernate.javax.persistence/hibernate-jpa-2.0-api/jars/hibernate-jpa-2.0-api-1.0.0.Final.jar javax.transaction/jta/jars/jta-1.1.jar org.hibernate/hibernate-c3p0/jars/hibernate-c3p0-3.6.0.Final.jar c3p0/c3p0/jars/c3p0-0.9.1.jar org.hibernate/hibernate-entitymanager/jars/hibernate-entitymanager-3.6.0.Final.jar cglib/cglib/jars/cglib-2.2.jar asm/asm/jars/asm-3.1.jar javassist/javassist/jars/javassist-3.12.0.GA.jar org.hibernate/hibernate-search/jars/hibernate-search-3.3.0.Final.jar org.hibernate/hibernate-search-analyzers/jars/hibernate-search-analyzers-3.3.0.Final.jar org.apache.lucene/lucene-core/jars/lucene-core-3.0.3.jar org.apache.lucene/lucene-analyzers/jars/lucene-analyzers-3.0.3.jar mysql/mysql-connector-java/jars/mysql-connector-java-5.1.13.jar com.ocpsoft/prettyfaces-jsf2/jars/prettyfaces-jsf2-3.0.1.jar commons-digester/commons-digester/jars/commons-digester-2.0.jar org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.6.1.jar log4j/log4j/bundles/log4j-1.2.16.jar xom/xom/jars/xom-1.2.5.jar xml-apis/xml-apis/jars/xml-apis-1.3.03.jar xerces/xercesImpl/jars/xercesImpl-2.8.0.jar xalan/xalan/jars/xalan-2.7.0.jar org.jboss.jsfunit/jboss-jsfunit-core/jars/jboss-jsfunit-core-1.3.0.Final.jar net.sourceforge.htmlunit/htmlunit/jars/htmlunit-2.8.jar xalan/xalan/jars/xalan-2.7.1.jar xalan/serializer/jars/serializer-2.7.1.jar xml-apis/xml-apis/jars/xml-apis-1.3.04.jar commons-collections/commons-collections/jars/commons-collections-3.2.1.jar commons-lang/commons-lang/jars/commons-lang-2.4.jar org.apache.httpcomponents/httpclient/jars/httpclient-4.0.1.jar org.apache.httpcomponents/httpcore/jars/httpcore-4.0.1.jar commons-codec/commons-codec/jars/commons-codec-1.4.jar org.apache.httpcomponents/httpmime/jars/httpmime-4.0.1.jar org.apache.james/apache-mime4j/jars/apache-mime4j-0.6.jar net.sourceforge.htmlunit/htmlunit-core-js/jars/htmlunit-core-js-2.8.jar xerces/xercesImpl/jars/xercesImpl-2.9.1.jar net.sourceforge.nekohtml/nekohtml/jars/nekohtml-1.9.14.jar net.sourceforge.cssparser/cssparser/jars/cssparser-0.9.5.jar org.w3c.css/sac/jars/sac-1.3.jar commons-io/commons-io/jars/commons-io-1.4.jar cactus/cactus/jars/cactus-13-1.7.1.jar cactus/cactus-ant/jars/cactus-ant-13-1.7.1.jar commons-httpclient/commons-httpclient/jars/commons-httpclient-2.0.2.jar junit/junit/jars/junit-3.8.1.jar aspectj/aspectjrt/jars/aspectjrt-1.2.1.jar cargo/cargo/jars/cargo-0.5.jar ant/ant/jars/ant-1.5.4.jar and this is my ivy.xml: <dependencies> <!-- JSF 2.0 RI --> <dependency org="com.sun.faces" name="jsf-api" rev="2.0.0"/> <dependency org="com.sun.faces" name="jsf-impl" rev="2.0.0"/> <!-- MyFaces Orchestra --> <dependency org="org.apache.myfaces.orchestra" name="myfaces-orchestra-core20" rev="1.5-SNAPSHOT"/> <dependency org="org.springframework" name="spring" rev="2.5.6"/> <dependency org="commons-el" name="commons-el" rev="1.0"/> <!-- RichFaces --> <dependency org="org.richfaces.ui" name="richfaces-ui" rev="3.3.3.Final"/> <dependency org="org.richfaces.framework" name="richfaces-impl-jsf2" rev="3.3.3.Final"/> <dependency org="com.sun.facelets" name="jsf-facelets" rev="1.1.14"/> <!-- Hibernate --> <dependency org="org.hibernate" name="hibernate-core" rev="3.6.0.Final"/> <dependency org="org.hibernate" name="hibernate-c3p0" rev="3.6.0.Final"/> <dependency org="org.hibernate" name="hibernate-entitymanager" rev="3.6.0.Final"/> <dependency org="org.hibernate" name="hibernate-search" rev="3.3.0.Final"/> <dependency org="mysql" name="mysql-connector-java" rev="5.1.13"/> <!-- PrettyFaces --> <dependency org="com.ocpsoft" name="prettyfaces-jsf2" rev="3.0.1"/> <!-- SLF4J --> <dependency org="org.slf4j" name="slf4j-api" rev="1.6.1"/> <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.6.1"/> <!-- XOM --> <dependency org="xom" name="xom" rev="1.2.5"/> <!-- JSF Unit --> <dependency org="org.jboss.jsfunit" name="jboss-jsfunit-core" rev="1.3.0.Final" conf="development"/> </dependencies> I am deploying to tomcat 6.0 Update After the answer below, I solved this by adding the following dependency to my ivy.xml: <dependency org="org.hibernate.javax.persistence" name="hibernate-jpa-2.0-api" rev="1.0.0.Final"/> then putting this jar above everything else under Eclipse's build order tab. I was using JRE/JDK 6.

    Read the article

  • Migrating from hand-written persistence layer to ORM

    - by Sergey Mikhanov
    Hi community, We are currently evaluating options for migrating from hand-written persistence layer to ORM. We have a bunch of legacy persistent objects (~200), that implement simple interface like this: interface JDBC { public long getId(); public void setId(long id); public void retrieve(); public void setDataSource(DataSource ds); } When retrieve() is called, object populates itself by issuing handwritten SQL queries to the connection provided using the ID it received in the setter (this usually is the only parameter to the query). It manages its statements, result sets, etc itself. Some of the objects have special flavors of retrive() method, like retrieveByName(), in this case a different SQL is issued. Queries could be quite complex, we often join several tables to populate the sets representing relations to other objects, sometimes join queries are issued on-demand in the specific getter (lazy loading). So basically, we have implemented most of the ORM's functionality manually. The reason for that was performance. We have very strong requirements for speed, and back in 2005 (when this code was written) performance tests has shown that none of mainstream ORMs were that fast as hand-written SQL. The problems we are facing now that make us think of ORM are: Most of the paths in this code are well-tested and are stable. However, some rarely-used code is prone to result set and connection leaks that are very hard to detect We are currently squeezing some additional performance by adding caching to our persistence layer and it's a huge pain to maintain the cached objects manually in this setup Support of this code when DB schema changes is a big problem. I am looking for an advice on what could be the best alternative for us. As far as I know, ORMs has advanced in last 5 years, so it might be that now there's one that offers an acceptable performance. As I see this issue, we need to address those points: Find some way to reuse at least some of the written SQL to express mappings Have the possibility to issue native SQL queries without the necessity to manually decompose their results (i.e. avoid manual rs.getInt(42) as they are very sensitive to schema changes) Add a non-intrusive caching layer Keep the performance figures. Is there any ORM framework you could recommend with regards to that?

    Read the article

  • Should Databases be used just for persistence

    - by Raju
    A lot of web applications having a 3 tier architecture are doing all the processing in the app server and use the database for persistence just to have database independence. After paying a huge amount for a database, doing all the processing including batch at the app server and not using the power of the database seems to be a waste. I have a difficulty in convincing people that we need to use best of both worlds.

    Read the article

  • No unique bean of type [javax.persistence.EntityManager] is defined

    - by sebajb
    I am using JUnit 4 to test Dao Access with Spring (annotations) and JPA (hibernate). The datasource is configured through JNDI(Weblogic) with an ORacle(Backend). This persistence is configured with just the name and a RESOURCE_LOCAL transaction-type The application context file contains notations for annotations, JPA config, transactions, and default package and configuration for annotation detection. I am using Junit4 like so: ApplicationContext <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceUnitName" value="workRequest"/> <property name="dataSource" ref="dataSource" /> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="databasePlatform" value="${database.target}"/> <property name="showSql" value="${database.showSql}" /> <property name="generateDdl" value="${database.generateDdl}" /> </bean> </property> </bean> <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"> <value>workRequest</value> </property> <property name="jndiEnvironment"> <props> <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop> <prop key="java.naming.provider.url">t3://localhost:7001</prop> </props> </property> </bean> <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean> <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/> <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /> JUnit TestCase @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:applicationContext.xml" }) public class AssignmentDaoTest { private AssignmentDao assignmentDao; @Test public void readAll() { assertNotNull("assignmentDao cannot be null", assignmentDao); List assignments = assignmentDao.findAll(); assertNotNull("There are no assignments yet", assignments); } } regardless of what changes I make I get: No unique bean of type [javax.persistence.EntityManager] is defined Any hint on what this could be. I am running the tests inside eclipse.

    Read the article

  • Environment variable expansion in persistence.xml (JPA)

    - by user342495
    I am developing a Eclipse RCP plugin which uses JPA. I tried to specify the database path via a variable give to the JVM on runtime. The property is set correctly but the database is created in a folder named after the variable name (here: ${DBHOME}). <property name="javax.persistence.jdbc.url" value="jdbc:derby:${DBHOME};create=true"/> Is there a possibility to fix this? Thx

    Read the article

  • Two Persistence Units, Two entityManagerFactory(s), SPring, JPA, Hibernate

    - by sebajb
    I am using Two entityManagerFactory{1,2} based on two persistence units, autowired through spring, hibernate, with resource local. My DaoImpls are configured with the PersistenceUnit(unitName='...') according to the unit needed. I was under the impression that using them with the unitName specified would allow me to use x number of PUs without problem but I still get: expected single matching bean but found two: [emf1, emf2]. Am I missing some other configuration?

    Read the article

  • How to model in J2EE / JEE?

    - by Harry
    Let's say, I have decided to go with J(2)EE stack for my enterprise application. Now, for domain modelling (or: for designing the M of MVC), which APIs can I safely assume and use, and which I should stay away from... say, via a layer of abstraction? For example, Should I go ahead and litter my Model with calls to Hibernate/JPA API? Or, should I build an abstraction... a persistence layer of my own to avoid hard-coding against these two specific persistence APIs? Why I ask this: Few years ago, there was this Kodo API which got superseded by Hibernate. If one had designed a persistence layer and coded the rest of the model against this layer (instead of littering the Model with calls to specific vendor API), it would have allowed one to (relatively) easily switch from Kodo to Hibernate to xyz. Is it recommended to make aggressive use of the *QL provided by your persistence vendor in your domain model? I'm not aware of any real-world issues (like performance, scalability, portability, etc) arising out of a heavy use of an HQL-like language. Why I ask this: I would like to avoid, as much as possible, writing custom code when the same could be accomplished via query language that is more portable than SQL. Sorry, but I'm a complete newbie to this area. Where could I find more info on this topic? Many thanks in advance. /HS

    Read the article

  • Persistence classes in Qt

    - by zarzych
    Hi, I'm porting a medium-sized CRUD application from .Net to Qt and I'm looking for a pattern for creating persistence classes. In .Net I usually created abstract persistence class with basic methods (insert, update, delete, select) for example: public class DAOBase<T> { public T GetByPrimaryKey(object primaryKey) {...} public void DeleteByPrimaryKey(object primaryKey) {...} public List<T> GetByField(string fieldName, object value) {...} public void Insert(T dto) {...} public void Update(T dto) {...} } Then, I subclassed it for specific tables/DTOs and added attributes for DB table layout: [DBTable("note", "note_id", NpgsqlTypes.NpgsqlDbType.Integer)] [DbField("note_id", NpgsqlTypes.NpgsqlDbType.Integer, "NoteId")] [DbField("client_id", NpgsqlTypes.NpgsqlDbType.Integer, "ClientId")] [DbField("title", NpgsqlTypes.NpgsqlDbType.Text, "Title", "")] [DbField("body", NpgsqlTypes.NpgsqlDbType.Text, "Body", "")] [DbField("date_added", NpgsqlTypes.NpgsqlDbType.Date, "DateAdded")] class NoteDAO : DAOBase<NoteDTO> { } Thanks to .Net reflection system I was able to achieve heavy code reuse and easy creation of new ORMs. The simplest way to do this kind of stuff in Qt seems to be using model classes from QtSql module. Unfortunately, in my case they provide too abstract an interface. I need at least transactions support and control over individual commits which QSqlTableModel doesn't provide. Could you give me some hints about solving this problem using Qt or point me to some reference materials? Update: Based on Harald's clues I've implemented a solution that is quite similar to the .Net classes above. Now I have two classes. UniversalDAO that inherits QObject and deals with QObject DTOs using metatype system: class UniversalDAO : public QObject { Q_OBJECT public: UniversalDAO(QSqlDatabase dataBase, QObject *parent = 0); virtual ~UniversalDAO(); void insert(const QObject &dto); void update(const QObject &dto); void remove(const QObject &dto); void getByPrimaryKey(QObject &dto, const QVariant &key); }; And a generic SpecializedDAO that casts data obtained from UniversalDAO to appropriate type: template<class DTO> class SpecializedDAO { public: SpecializedDAO(UniversalDAO *universalDao) virtual ~SpecializedDAO() {} DTO defaultDto() const { return DTO; } void insert(DTO dto) { dao->insert(dto); } void update(DTO dto) { dao->update(dto); } void remove(DTO dto) { dao->remove(dto); } DTO getByPrimaryKey(const QVariant &key); }; Using the above, I declare the concrete DAO class as following: class ClientDAO : public QObject, public SpecializedDAO<ClientDTO> { Q_OBJECT public: ClientDAO(UniversalDAO *dao, QObject *parent = 0) : QObject(parent), SpecializedDAO<ClientDTO>(dao) {} }; From within ClientDAO I have to set some database information for UniversalDAO. That's where my implementation gets ugly because I do it like this: QMap<QString, QString> fieldMapper; fieldMapper["client_id"] = "clientId"; fieldMapper["name"] = "firstName"; /* ...all column <-> field pairs in here... */ dao->setFieldMapper(fieldMapper); dao->setTable("client"); dao->setPrimaryKey("client_id"); I do it in constructor so it's not visible at a first glance for someone browsing through the header. In .Net version it was easy to spot and understand. Do you have some ideas how I could make it better?

    Read the article

  • Atomikos rollback doesn't clear JPA persistence context?

    - by HDave
    I have a Spring/JPA/Hibernate application and am trying to get it to pass my Junit integration tests against H2 and MySQL. Currently I am using Atomikos for transactions and C3P0 for connection pooling. Despite my best efforts my DAO integration one of the tests is failing with org.hibernate.NonUniqueObjectException. In the failing test I create an object with the "new" operator, set the ID and call persist on it. @Test @Transactional public void save_UserTestDataNewObject_RecordSetOneLarger() { int expectedNumberRecords = 4; User newUser = createNewUser(); dao.persist(newUser); List<User> allUsers = dao.findAll(0, 1000); assertEquals(expectedNumberRecords, allUsers.size()); } In the previous testmethod I do the same thing (createNewUser() is a helper method that creates an object with the same ID everytime). I am sure that creating and persisting a second object with the same Id is the cause, but each test method is in own transaction and the object I created is bound to a private test method variable. I can even see in the logs that Spring Test and Atomikos are rolling back the transaction associated with each test method. I would have thought the rollback would have also cleared the persistence context too. On a hunch, I added an a call to dao.clear() at the beginning of the faulty test method and the problem went away!! So rollback doesn't clear the persistence context??? If not, then who does?? My EntityManagerFactory config is as follows: <bean id="myappTestLocalEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceUnitName" value="myapp-core" /> <property name="persistenceUnitPostProcessors"> <bean class="com.myapp.core.persist.util.JtaPersistenceUnitPostProcessor"> <property name="jtaDataSource" ref="myappPersistTestJdbcDataSource" /> </bean> </property> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="showSql" value="true" /> <property name="database" value="$DS{hibernate.database}" /> <property name="databasePlatform" value="$DS{hibernate.dialect}" /> </bean> </property> <property name="jpaProperties"> <props> <prop key="hibernate.transaction.factory_class">com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory</prop> <prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop> <prop key="hibernate.connection.autocommit">false</prop> <prop key="hibernate.format_sql">true"</prop> <prop key="hibernate.use_sql_comments">true</prop> </property> </bean>

    Read the article

  • Efficiently Determine if EF 4 POCO Already in ObjectSet

    - by Eric J.
    I'm trying EF 4 with POCO's on a small project for the first time. In my Repository implementation, I want to provide a method AddOrUpdate that will add a passed-in POCO to the repository if it's new, else do nothing (as the updated POCO will be saved when SaveChanges is called). My first thought was to do this: public void AddOrUpdate(Poco p) { if (!Ctx.Pocos.Contains<Poco>(p)) { Ctx.Pocos.AddObject(p); } } However that results in a NotSupportedException as documented under Referencing Non-Scalar Variables Not Supported (bonus question: why would that not be supported?) Just removing the Contains part and always calling AddObject results in an InvalidStateException: An object with the same key already exists in the ObjectStateManager. The existing object is in the Unchanged state. An object can only be added to the ObjectStateManager again if it is in the added state. So clearly EF 4 knows somewhere that this is a duplicate based on the key. What's a clean, efficient way for the Repository to update Pocos for either a new or pre-existing object when AddOrUpdate is called so that the subsequent call to SaveChanges() will do the right thing? I did consider carrying an isNew flag on the object itself, but I'm trying to take persistence ignorance as far as practical.

    Read the article

  • Fluent NHibernate - exception occurred during configuration of persistence layer

    - by inutan
    Hello there, I am using Fluent NHibernate with an external 'hibernate.cfg.xml' file. Following is the configuration code where I am getting error: var configuration = new Configuration(); configuration.Configure(); _sessionFactory = Fluently.Configure(configuration) .Mappings(m => m.FluentMappings.AddFromAssemblyOf<Template>()) .BuildSessionFactory(); return _sessionFactory; But When NHibernate is trying to configure, I am getting floowing error: An exception occurred during configuration of persistence layer. Please help.

    Read the article

  • BigDecimal precision not persisted with javax.persistence annotations

    - by dkaczynski
    I am using the javax.persistence API and Hibernate to create annotations and persist entities and their attributes in an Oracle 11g Express database. I have the following attribute in an entity: @Column(precision = 12, scale = 9) private BigDecimal weightedScore; The goal is to persist a decimal value with a maximum of 12 digits and a maximum of 9 of those digits to the right of the decimal place. After calculating the weightedScore, the result is 0.1234, but once I commit the entity with the Oracle database, the value displays as 0.12. I can see this by either by using an EntityManager object to query the entry or by viewing it directly in the Oracle Application Express (Apex) interface in a web browser. How should I annotate my BigDecimal attribute so that the precision is persisted correctly? Note: We use an in-memory HSQL database to run our unit tests, and it does not experience the issue with the lack of precision, with or without the @Column annotation.

    Read the article

  • javax.persistence.NoResultException: getSingleResult() did not retrieve any entities

    - by apple1988
    Hello, i have created a namedquery with ejb to check if the username is used. When the singleResult is null, then i get the following Exception : javax.persistence.NoResultException: getSingleResult() did not retrieve any entities But this exception is the result that i want when the username is free. ^^ Here is the code: public User getUserByUsername(String username) throws DAOException{ try{ Query q = em.createNamedQuery(User.getUserByUsername); q.setParameter("username", username); return (User) q.getSingleResult(); }catch(Exception e){ throwException(username, e); return null; } } Does anybody know what the problem is. :( I will return null andy don`t get an Exception. Thank you very much

    Read the article

  • Is it possible to scan Entities in jar files using JPA and hibernate

    - by user1260109
    I have the following situation : Project A - Contains a few entities and is independent Project B - Contains a few entities and is independent Project C - Contains few entities and is dependent on Project A & Project B. I am using Maven to manage dependencies and builds. When I try to test Project A and project B it goes through fine. Each of them has a persistence.xml and a separate persistent context. When I run Project C , It does map any of the entities. I have tried to use the auto-detect, specified the jar file attribute ... but nothing seems to work. It gives me a Mapping Exception saying unknown entity and wont persist or read the Entities from Projects A or B. I have posted the 3 persistence.xml files here. Also, I tried using the class attribute and using the same persistent context but it just wont find the files. Any help is really appreciated. Thanks in advance ! <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="A" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/> <property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.connection.username" value="username"/> <property name="hibernate.connection.password" value="password"/> <property name="hibernate.connection.url" value="jdbc:oracle:thin:@webdev.epi.web:1521/webdev.world"/> <property name="hibernate.max_fetch_depth" value="3"/> <property name="hibernate.archive.autodetection" value="class"/> </properties> </persistence-unit> </persistence> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="B" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/> <property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.connection.username" value="username"/> <property name="hibernate.connection.password" value="password"/> <property name="hibernate.connection.url" value="jdbc:oracle:thin:@webdev.epi.web:1521/webdev.world"/> <property name="hibernate.max_fetch_depth" value="3"/> <property name="hibernate.archive.autodetection" value="class"/> </properties> </persistence-unit> </persistence> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="C" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jar-file>A-0.0.1-SNAPSHOT.jar</jar-file> <jar-file>B-0.0.1-SNAPSHOT.jar</jar-file> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/> <property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.connection.username" value="username"/> <property name="hibernate.connection.password" value="password"/> <property name="hibernate.connection.url" value="jdbc:oracle:thin:@webdev.epi.web:1521/webdev.world"/> <property name="hibernate.max_fetch_depth" value="3"/> <property name="hibernate.archive.autodetection" value="class"/> </properties> </persistence-unit> </persistence>

    Read the article

  • Designer serialization persistence problem in .NET, Windows Forms

    - by Jules
    ETA: I have a similar, smaller, problem here which, I suspect, is related to this problem. I have a class which has a readonly property that holds a collection of components (* not quite, see below). At design time, it's possible to select from the components on the design surface to add to the collection. (Think imagelist, but instead of selecting one, you can select as many as you want.) As a test, I inherit from button and attach my class to it as a property. The persistence problem occurs when I add a component,to the collection, from the design surface after I have added my button to the form. The best way to demonstrate this is to show you the designer generated code: Private Sub InitializeComponent() Dim Provider1 As WindowsApplication1.Provider = New WindowsApplication1.Provider Me.MyComponent2 = New WindowsApplication1.MyComponent Me.MyComponent1 = New WindowsApplication1.MyComponent Me.MyButton1 = New WindowsApplication1.MyButton Me.MyComponent3 = New WindowsApplication1.MyComponent Me.SuspendLayout() ' 'MyButton1 ' Me.MyButton1.ProviderCollection.Add(Me.MyButton1.InternalProvider) Me.MyButton1.ProviderCollection.Add(Me.MyComponent1.Provider) Me.MyButton1.ProviderCollection.Add(Me.MyComponent2.Provider) Me.MyButton1.ProviderCollection.Add(Provider1) //Wrong should be Me.MyComponent3.Provider ' 'Form1 ' Me.Controls.Add(Me.MyButton1) End Sub Friend WithEvents MyComponent1 As WindowsApplication1.MyComponent Friend WithEvents MyComponent2 As WindowsApplication1.MyComponent Friend WithEvents MyButton1 As WindowsApplication1.MyButton Friend WithEvents MyComponent3 As WindowsApplication1.MyComponent End Class As you can see from the code, the collection is not actually a collection of the components, but a collection of a property, 'Provider', from the components. It looks like the problem is occurring because MyComponent3 is created after MyButton. However, in my opinion, this should not make any difference - by the time the serializer comes to add the provider property of MyComponent3, it's already created. Note: You may wonder, why I'm not using AddRange to persist the collection. The reason for this is that if I do, the behaviour changes and none of the items will persist correctly. The designer will create local fields - like Provider1 - for each item in the collection. However if I add another collection to the class which holds the actual MyComponents and persist this, then, somehow, the AddRange method persists correctly in ProviderCollection! There seems to be some kind of quantum double slit experiment going down in code dom. How can I solve this problem?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >