Hello,
I have a database schema like this:
My database schema: http://i.imgur.com/vFKRk.png
To explain the context: One user writes one message. He can send it to one or more users.
I succeeded to get the title of message, the author for one user. However Doctrine, which I use for this project, do it with 2 queries. It's a little bi...
Hello All! i have new problem with JPA in EJB3
my stacktrace are:
Caused by: javax.persistence.NonUniqueResultException: More than one result was returned from Query.getSingleResult()
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.throwNonUniqueResultException(EJBQueryImpl.java:1207)
at org.eclipse.persistence.int...
dear all,
I need new design patterns in JPA/ORM instead of POJO/JDBC/DAO patterns.
Is there any recommended link?
RGDS
...
Probably it is a basic question, but could not found the answer anywhere in the web.
I am trying to use a second level cache (using ehcache) and just checked that some objects were being retrieved from database every time I tried to load them, the only difference was that I was not getting them by id but by a property that carries a SE...
I am having an issue in setting up a one to many relationship in my annotated object.
I have the following:
@MappedSuperclass
public abstract class MappedModel
{
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="id",nullable=false,unique=true)
private Long mId;
then this
@Entity
@Table(name="customer")
...
How can I persist a collections field (e.g. List[String] or Set[Int]) with Squeryl? What's the best way to encode it such that Squeryl won't create an association table?
...
i want to try to find out all the fieldValue based on fieldName
MNC.java:
`private Map <String, String>formFields = new HashMap<String, String>();
public void setFieldValue(String fieldName, String fieldValue) {
if (formFields == null) {
formFields = new HashMap<String, String>();
}
formFields.put(f...
Hi,
I'm currently trying to implement a ManyToMany Relationship with Data in the JoinTable.
I'm following this approach with the Eclipselink JPA Framework.
But I'm getting the following exception:
org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:210)
... 23 more
...
if i use table name instead of class name in HQL query like this:
select classname.field name as obj from table name
and i have specified mapping in hbm file. but it show exception: table name is not mapped
and second thing is i have use on keyword in query then it show exception:
unexpected token: on
...
EclipseLink normally generates SQLs like:
SELECT t0.ID, t1.NAME FROM MAN t0, WIFE t1 WHERE t0.ID = t1.MAN_ID
Is it possible to tell EclipseLink, that it should use full table names for aliases to make the query more readable?
SELECT t0_MAN.ID, t1_WIFE.NAME FROM MAN t0_MAN, WIFE t1_WIFE WHERE t0_MAN.ID = t1_WIFE.MAN_ID
I think Hiber...
Hi,
I'm starting up a rather large-scale open source server project written in C# which targets both the MS.NET and Mono platforms. However, I realized that Mono only has limited support for LINQ to SQL, and no support for the Entity Framework at all.
Two ORMs I have considered are NHibernate and SubSonic. However, I have no idea how e...
Hi i am using Java 1.6 with hibernate and spring. I am having problems with hibernate models using inheritance mapping of type @Inheritance(strategy=InheritanceType.JOINED), or table per subclass.
Scenario:
we have 3 tables each mapped to a hibernate model
each table shares the same single column primary key
the java models extend eac...
I've wired up IPreInsertEventListener and IPreUpdateEventListener to manage audit logging in my app, which is using NHibernate as the ORM layer.
The problem I'm having is that the OnPreInsert() event is fired when the object is persisted, but is not fired for each inserted child object as well.
In my case, I have a Canine, which has a ...
I have an one-to-one, bidirectional entity relationship with shared keys. When I attempt to save the owner of the association I get a "null id generated" exception against the owned side of the relationship. I am utilizing hibernate-entitymanager and using spring for transaction management.
Owning Entity
@Entity
@Table(name = "lead")
p...
What is the benefit of detached object? What value do they provide? Thanks.
...
I have a very simple table(mapped as AuthToken class), consisting of a string ('token'), and a userid (foreign key to another table), with 'user' as relation ( = class User)
session.query(AuthToken.user).one() gives back the token, and the userid (as a tuple), but not the user object.
Does anybody know why?
thanks!
...
I want to start building better persistence layers using NHibernate and other ORMs. What are the best design patterns or important design considerations for implementing persistence with ORM?
...
Hi!
I'm relatively new to hibernate technology, and want to create an application with that. I have read that is not recomanded to use "hibernate's creation tabels" option (hibernate.hbm2ddl.auto) for a production environment. Does that mean that i need to create first tables and after that my POJOs classes or this recomandations is onl...
All,
Is there some setting that I can tell hbm2ddl to run a view creation statement instead of create a table when generating the database schema?
I'm creating my database schema using the wonderful hbm2ddl tool, but I have one issue. I need to flatten some of the tables into views to aid searching the database, and hql would be over...
I have a SQLAlchemy ORM model that currently looks a bit like this:
Base = declarative_base()
class Database(Base):
__tablename__ = "databases"
__table_args__ = (
saschema.PrimaryKeyConstraint('db', 'role'),
{
'schema' : 'defines',
},
)
db = Column(String, nullable=False)
role = Column(String, nullabl...