Search Results

Search found 2391 results on 96 pages for 'hibernate'.

Page 20/96 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • Cannot instantiate abstract class or interface : problem while persisting

    - by sammy
    i have a class campaign that maintains a list of AdGroupInterfaces. im going to persist its implementation @Entity @Table(name = "campaigns") public class Campaign implements Serializable,Comparable<Object>,CampaignInterface { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @OneToMany ( cascade = {CascadeType.ALL}, fetch = FetchType.EAGER, targetEntity=AdGroupInterface.class ) @org.hibernate.annotations.Cascade( value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN ) @org.hibernate.annotations.IndexColumn(name = "CHOICE_POSITION") private List<AdGroupInterface> AdGroup; public Campaign() { super(); } public List<AdGroupInterface> getAdGroup() { return AdGroup; } public void setAdGroup(List<AdGroupInterface> adGroup) { AdGroup = adGroup; } public void set1AdGroup(AdGroupInterface adGroup) { if(AdGroup==null) AdGroup=new LinkedList<AdGroupInterface>(); AdGroup.add(adGroup); } } AdGroupInterface's implementation is AdGroups. when i add an adgroup to the list in campaign, campaign c; c.getAdGroupList().add(new AdGroups()), etc and save campaign it says"Cannot instantiate abstract class or interface :" AdGroupInterface its not recognizing the implementation just before persisting... Whereas Persisting adGroups separately works. when it is a member of another entity, it doesnt get persisted. import java.io.Serializable; import java.util.List; import javax.persistence.*; @Entity @DiscriminatorValue("1") @Table(name = "AdGroups") public class AdGroups implements Serializable,Comparable,AdGroupInterface{ /** * */ private static final long serialVersionUID = 1L; private Long Id; private String Name; private CampaignInterface Campaign; private MonetaryValue DefaultBid; public AdGroups(){ super(); } public AdGroups( String name, CampaignInterface campaign) { super(); this.Campaign=new Campaign(); Name = name; this.Campaign = campaign; DefaultBid = defaultBid; AdList=adList; } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="AdGroup_Id") public Long getId() { return Id; } public void setId(Long id) { Id = id; } @Column(name="AdGroup_Name") public String getName() { return Name; } public void setName(String name) { Name = name; } @ManyToOne @JoinColumn (name="Cam_ID", nullable = true,insertable = false) public CampaignInterface getCampaign() { return Campaign; } public void setCampaign(CampaignInterface campaign) { this.Campaign = campaign; } } what am i missing?? please look into it ...

    Read the article

  • GWT Date Picker Format problem when saving a java date through hibernate in postgresql

    - by Noor
    Hi, I am using Java Date and Hibernate which is then being saved in the database (Postgresql). I am not that good in hibernate Part of the Mapping File <property name="DateOfBirth" type="java.util.Date"> <column name="DATEOFBIRTH" /> </property> I am using GWT Date picker Short date format i.e. yyyy-MM-dd. I am getting the value from the date picker using View.getUserDateOfBirth().getValue() But when I am saving the date 2010-11-30 into the datebase it is saving it as 2010-11-30 00:00:00 instead of 2010-11-30 So, I want it to be saved in the database as in this format 2010-11-30?? I have many things such timestamp but i not being able to configure it. I think this part <property name="DateOfBirth" type="java.util.Date"> <column name="DATEOFBIRTH" /> </property> should be changed but I do not know what to change

    Read the article

  • CascadeType problem in One to Many Relation

    - by Milad.KH
    Hi I have two classes which have a Unidirectional One to Many relation with each other. public class Offer{ ... @OneToMany(cascade=CascadeType.ALL) @JoinTable(name = "Offer_Fields", joinColumns = @JoinColumn(name = "OFFER_ID"), inverseJoinColumns = @JoinColumn(name = "FIELDMAPPER_ID")) private Set<FieldMapper> fields = new HashSet<FieldMapper>(); } public class FieldMapper{ ... } I want to store an Offer with a set of FieldMapper to database. When I Use CascadeType.ALL in my OneToMany, I got this error: org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions and when I change CascadeType to something else I got this error: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.RCSTT.library.FieldMapper Thanks for your help.

    Read the article

  • Load data from CSV to mySQL database Java+hibernate+spring

    - by mona
    I am trying to load a CSV file in to mySQL database using Java+Hibernate+Spring. I am using the following query in the DAO to help me load in to the database: entityManager.createQuery("LOAD DATA INFILE :fileName INTO TABLE test").setParameter("fileName", "C:\\samples\\test\\abcd.csv").executeUpdate(); I got some idea to use this from http://dev.mysql.com/doc/refman/5.1/en/load-data.html and how to import a csv file into a mysql from an hibernate+spring application? But I am getting the error: java.lang.IllegalArgumentException: node to traverse cannot be null! Please help! Thanks

    Read the article

  • JSR-303 dependency injection and Hibernate

    - by Jam
    Spring 3.0.2, Hibernate 3.5.0, Hibernate-Validator 4.0.2.GA I am trying to inject Spring dependencies into a ConstraintValidator using: @PersistenceContext private EntityManager entityManager; I have configured the application context with: <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/> Which, according to the Spring documentation, should allow “custom ConstraintValidators to benefit from dependency injection like any other Spring bean” Within the debugger I can see Spring calling getBean to create the ConstraintValidator. Later when flush triggers the preInsert, a different ConstraintValidator is created and called. The problem is the EntityManager is null within this new ConstraintValidator. I’ve tried injecting other dependencies within the ConstraintValidator and these are always null. Does anyone know if it is possible to inject dependencies into a ConstraintValidator?

    Read the article

  • Hibernate or JPA or JDBC or ???

    - by Yatendra Goel
    I am developing a Java Desktop Application but have some confusions in choosing a technology for my persistence layer. Till now, I have been using JDBC for DB operations. Now, Recently I learnt Hibernate and JPA but still I am a novice on these technologies. Now my question is What to use for my Java Desktop Application from the following? JPA Hibernate JDBC DAO any other suggestion from you... I know that there is no best choice from them and it totally depends on the complexity and the requeirements of the project so below are the requirements of my project It's not a complex application. It contains only 5 tables (and 5 entities) I wan't to make my code flexible so that I can change the database later easily The size of the application should remain as small as possible as I will have to distribute it to my clients through internet. It must be free to use in commercial development and distribution.

    Read the article

  • Do Hibernate table classes need to be Serializable?

    - by Scott Leis
    I have inherited a Websphere Portal project that uses Hibernate 3.0 to connect to a SQL Server database. There are about 130 Hibernate table classes in this project. They all implement Serializable. None of them declare a serialVersionUID field, so the Eclipse IDE shows a warning for all of these classes. Is there any actual need for these classes to implement Serializable? If so, is there any tool to add a generated serialVersionUID field to a large number of classes at once (just to make the warnings go away) ?

    Read the article

  • hibernate search

    - by Odelya
    Hi! I am using Hibernate. I am looking for a free text engine. Before I investigate into it I need your experience. I have in my applications user, role and object table. Where a user is connected to one or more roles, and a role is connected to one or more objects. In my free text search, the user can reach only data that he is allowed to watch by object table. Can Hibernate search help me with it?

    Read the article

  • How to keep an Hibernate's Session open until the page is rendered

    - by Neuquino
    I'm having the following problem: I'm using Oracle ADF for the view and controller of my app. With OpenSessionInViewFilter, I intercept the request and open an Hibernate's Session, and it is closed as soon as the bean's method finishes. What I need is to keep the Session opened until the page is rendered, because in my JSP y use the lazy attributes of the object i load from the DB. For example: When I enter index.jspx the IndexBean#main() is executed: public class IndexBean{ private DBObject myDBObject; public String main(){ this.myDBObject = this.myDAO.loadObjectFromDB(); return null; } } in index.jspx I have: ... <af:inputText value="#{myDBObject.lazyAttribute}" /> ... I'd like that the Hibernate's Session keeps open until the af:inputText is processed. Is this possible? How? Thanks in advance

    Read the article

  • Hibernate @Index on @Enumerated field doesn't work

    - by mlaverd
    I am using Hibernate to talk to my DB. I have one field that is an enumeration and it is going to be used in a slow query. So I'd like to index it. I've put the following annotations on the field: @Column(name="RIGHT_TYPE", unique=false, nullable=false, length=10) @Enumerated(EnumType.STRING) @Index(name = "ABC_INDEX") protected RightType rightType; However, I don't see any index on that field created. But I can create one manually if I wish so. Why is that? Is there any way to force Hibernate to make it happen?

    Read the article

  • How to make query on a property from a joined table in Hibernate using Criteria

    - by Palo
    Hello, I have the following mapping: <hibernate-mapping package="server.modules.stats.data"> <class name="User" table="user"> <id name="id"> <generator class="native"></generator> </id> <many-to-one name="address" column="addressId" unique="true" lazy="false" /> </class> <class name="Address" table="address"> <id name="id"> <generator class="native"></generator> </id> <property name="street" /> </class> </hibernate-mapping> How can I do a Criteria query to select all users living on some street? That is create Criteria query for this SQL: Select * from user join address on user.addressId = address.id where address.street='someStreet'

    Read the article

  • PostgreSQL like + Hibernate problem

    - by Marat_Galiev
    Hi all. I want to do search in PostgreSQL for INTEGER based columns. if (!sSearch.isEmpty()) { sSearch = sSearch.replaceAll("[^a-zA-Z0-9]", "_").toLowerCase(); String[] search = sSearch.split(" "); sWhere = " "; for (NewsColumns column : NewsColumns.values()) { for (String s : search) { sWhere += "lower(" + column + "::TEXT) LIKE '%" + s + "%' OR "; } } sWhere = sWhere.substring(0,sWhere.length()-3); } Ok, I want to convert INT value to String before search, with '::TEXT' expression. But after executing I'm getting: org.hibernate.QueryException: Not all named parameters have been set: [:TEXT] [select * from news WHERE lower(ID::TEXT) LIKE '%5%' Exception. Looks like hibernate parse my convert exp as parameter. Any help is appreciated. Thanks.

    Read the article

  • netbeans + hibernate for java swing application

    - by blow
    Hi all, im developing a java swing app and i would use hibernate for persistance. Im totally new in jpa, hibernate and ORM in general. Im follow this tutorial, its easy but the problem is the java class that descrive a table in db are made from the table with reverse enginering. I want do the opposite process: i want make db table from the java class. The question is, how can i do this with netbeans? There are some tutorial?

    Read the article

  • CDI, Hibernate JSF on jetty

    - by Arash
    I am trying to make Weld, hibernate, jsf combination work on Jetty. The best approach I found on internet was http://www.laliluna.de/articles/2011/01/12/jboss-weld-jpa-hibernate.html . It was a pain to clean up the dependencies, but I managed to go through that. Now it works for me except the initialization part of the EntityManagerStoreImpl. It seems the weld listener for jetty does not produce a ContainerInitialized event, so the init method which observes this event is never called. Could you tell me please what is the best way to bootstrap this class in the jetty environment? thanks!

    Read the article

  • Spring, Hibernate and Ehcache - Wrong entities

    - by asrijaal
    Hi there, I've got a webapp which uses spring+hibernate for my data layer. I'm using 2nd level caching with ehcache as provider. Everything seems to work so far but sometimes we encounter a problem which I can't really figure out atm. One of my tables is used for labels within the application - every user who logs access this table with his set language. Works for 90% of the time. But sometimes the user gets labels for the wrong language, e.g. instead of german everything turns to italian. After a logout and login all labels are correct. Does anyone of you encountered something like this? I'm not sure where to look at: spring+hibernate+ehcache is a solid package or is it not? Cheers

    Read the article

  • Hibernate session method to update object

    - by EugeneP
    I need this roadmap of a Hibernate managed object instance. First, I create an instance with initial properties and persist this object in a db. Then session associated with this object is closed. But still, I serialize my object and on the next step deserialize it, invoke some setters, and again, I need to update what changed in a database. What methods of Hibernate session should I use? persist() or save() on the first step and saveOrUpdate() on the second? In fact I see that saveOrUpdate() can be used on each step. What would you recommend?

    Read the article

  • Setup Hibernate Session Factory in Tomcat

    - by Mark Estrada
    Hi All, I have been reading around the Hibernate core and I am still exploring some of its capability. It was mention in the docs that the SessionFactory is the heavyweight component of Hibernate thus it should be setup only once in a web application and in singleton. Each Session factory should pertain to one JDBC connection. Does anybody knows how to properly setup the session factory in tomcat web applications? Any links or tutorials would be better. Should I set it up as a contextlistener class also? Thanks.

    Read the article

  • Caching using hibernate

    - by Subhendu Mahanta
    I have 2 applications.First one is a web application through which we provision reference data.Second one is an ESB based application where the reference data is used.The reference data changes but not very frequently.We needed to cache the reference data.The web application( I am not the owner) used hibernate. But my ESB based application did not.We only used EHCache. When reference data is changed by the independent web application that needs to be reflected in ESB application.We implemented using message queue - that is when reference data changes web application sends a message to the message queue.Our ESB application listens to that message & clears the cache & caches the data once again.This works.But it is time intensive.How can I use Hibernate to improve the situation? Regards, Subhendu

    Read the article

  • net.sf.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type

    - by lot
    Hi! What might be reasons for running in the quoted exception upon a HQL select, when there is actually no NULL value in the respective field in the database? I've checked the database multiple times. I've manually submitted the query statement produced by hibernate (extracted from debug). Null values for the respective field are actually never returned. However, the corresponding row in the database is in fact nullable. Does hibernate care about the data base definition? I know, I could simple change the filed to a wrapper type, but we have a number of such fields in a legacy application and this only occurs upon a single query. I'm just wondering about the actual reason for getting this exception only with a single property. Any hints would be greatly appreciated.

    Read the article

  • Hibernate bug using Oracle?

    - by Lothar
    Hello, I've got the problem, that I use a property in the persistence.xml which forces Hibernate to look only for tables in the given schema. <property name="hibernate.default_schema" value="FOO"/> Because we are using now 4 different schemas the actual solution is to generate 4 war files with a modified persistence.xml. That not very elegant. Does anybody know, how I can configure the schema with a property or by manipulation the JDBC connection string? I'm using Oracle 10g, 10_2_3 Patch. Thanks a lot.

    Read the article

  • Hibernate HQL to basic SQL

    - by CC
    Hello everybody, I working on a project with Hibernate and we need to replace Hibernate with some "home made persistence" stuff. The idea is that the project is big enough, and we have many HQL queries. The problem is with the queries like select a,b from table1, table2 on t1.table1=t2.table2 Basically all joins are not supported by our "hand made persistence" stuff. What I would need, is to be able to do some sort of transcoder, which will take as a input the HQL queries and output some SQL, but the basic SQL without joins, something like (a dumb example) select a from table1 where t1 IN ( select b from table2) I hope you get the idea. My persistence layer does not supports joins. Does anybody has any idea about something like that? Some framework, or something? Thanks alot everybody. C.C.

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >