i am try to run a sample application of hibernate, it give me a error on run time:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NullPointerException
at transaction.rollback();
this is in Main....
i am using MySQL workbench 5.2 CE database with a basic hibernate program
at run time it give me error:
Caused by: org.hibernate.HibernateException: JDBC Driver class not found: com.mysql.jdbc.Driver
this code in hibernate.cfg.xml:
<hibernate-configuration>
<session-factory>
<property name="dialect">org.hibernate.dial...
We have a JPA application (using hibernate) and we need to pass a call to a legacy reporting tool that needs a JDBC database connection as a parameter. Is there a simple way to get access to the JDBC connection hibernate has setup?
...
How do you set up dynamic property defaults on CF9 ORM objects?
For instance, I know I can set a property default like this:
property name="isActive" default="1";
But what if you want to have a dynamically generated default, such as a date or a UUID?
property name="uuid" default="#createUUID()#";
...throws an error - so what's the...
Using Hibernate, I'm facing an exception saying a different object with the same identifier value was already associated with the session.
I don't know what's the cause of this exception and how to deal with it? If someone knows please teach me, thanks.
And next is a part of my code,
public void addRoleToUser(String userLogin, RoleBe...
does insert query in hibernate requires table to be present. I mean when i have a query that insert some values in to the table which is not present . will the hibernate gives the exception or it will through the exception only when update is done .
I'm speaking in terms of only hibernate .
Can you please suggest
...
Even though I set the attribute to be @Column(unique=true), I still insert a duplicate entry.
@Entity
public class Customer {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(unique=true )
private String name;
...
}
I set the name using regular EL in JSF. I did not create table ...
In the Database:
TIMESTAMP DEVICE_ID SRC_ADDR PKTS_FWDED
-------------------------------------------
2010-08-10 11:45:07.547 4 2887253771 3
2010-08-10 11:45:09.547 4 2887253771 18
output of Hibernate:
TIMESTAMP = 2010-08-10 11:45:07.547 DEVICE_ID: 4 SRC_ADDR: 2887253771 PKTS_FWDED 3
TIMESTAMP = 2010-08-10 11:45:07.547 DEVICE_ID...
Is there a way to run these queries as if I added a (NOLOCK) hint to them?
...
I know this question has been asked before but I have a design question as well.
There are two tables like so:
Table Group_table
column pk_Group_name
column group_type
etc
Table Group_members
column fk_group_name -> foreign key to group_table
column group_member
It's easy to work with this structure but I have two questions. First,...
I get the following error session.save(student);
org.hibernate.HibernateException: The database returned no natively generated identity value
Here is main function
{
BasicConfigurator.configure();
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction transaction = null;
try {
transaction = session...
I would like to implement inheritance in Hibernate.
I created ObjectClass object:
@Entity
@Table(name = "object")
@Inheritance(strategy = InheritanceType.JOINED)
public class ObjectClass {
private id;
}
and CodeTable object that inhertance Object class:
@Entity
@ForeignKey(name = "id")
@Table(name = "code_table")
public class ...
I am trying to establish a relationship between 2 entities which would be zero-to-one. That is, the Parent can be saved without the associated Child entity and also along with the assoicated Child.
Following are the 2 Entity classes...
Employee (Parent)
public class Employee {
@Id
@GeneratedValue(strategy = GenerationType.AUT...
I have the following LLBLGen code that retrieves articles by Category. Essentially it is selecting from the article table where the articles are not marked for deletion and joining on the ArticleTopicCategory table to retrieve specific categories (where category = 'string')
ArticleCollection articles = new ArticleCollection();
...
I am using Hibernate entity manager 3.5.1-Final with MS SQL Server 2005 and trying to persist multiple new entities. My entity is annotationally configured thus:
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
After calling
entityManager.persist(newEntity)
I do not see the generatedId set, it remains as 0. ...
I have two MySQL-Tables (oversimplified):
articles
- id
- description
article_attributes
- article_id
- attribute_name
- attribute_value
So, every article can have an unlimited amount of attributes.
For the articles i have a Kohana_ORM Model
<?php class Model_Article extends ORM {} ?>
When loading the Model I would like to have ac...
I'm currently stuck with what seems to be a very simple problem, but I just can't seem to find a way around:
I have 2 identical tables:
tbl_creditcard_approved_txns
tbl_creditcard_declined_txns
The fields in both are identical, and I have one class - Transaction that is used to represent all the appropriate fields in the tab...
I recently started work at a new shop that uses a table naming convention like the following:
Users
UserRoles
UserUserRoles
UserProfiles
UserProfileLanguages
The convention I've been using is:
Users
Roles
UserRoleMaps
Profiles
Languages
When my boss asked why I don't prefix my tables, I explained that a database diagram would exp...
Is there a way to get CF9 ORM to insert NULL Values into the database rather than an empty string?
I've got a numeric field which can be null, but throws an error because it's trying to enter ''.
...
I have a database with a bunch of reference tables like States, Languages, etc.. I would like to be able to cache these tables and then use those types in any ObjectContext I want. So in pseudo code I want to be able to do something like this
var db1 = new PatientObjectContext();
Cache.CacheStates(db1.States.ToList())
var person = new ...