[Hibernate-JIRA] Created: (BVAL-253) you have not found the woods
by tfgfghg (JIRA)
you have not found the woods
----------------------------
Key: BVAL-253
URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-253
Project: Bean Validation
Issue Type: Story
Reporter: tfgfghg
Chun-fang break free
Author: Mo to natural
Wedge
"Woods, Do not you feel better tonight's moon particular?" David shook the hand of the woods, with a blunt Chinese asked.
"Is it?" The woods wearing a Versace dress absently replied. Busy in Beijing a week, she finally get a new store opening preparations, is planning to take rest for one day back to Nanjing, the [url=" http://www.savemalls.com/products/Handbags-c4_p1.html ] wholesale handbags from china[/url]results today at noon the plane, opposite the romantic nature of the French men grabbed her on the car, mysteriously said to give her a surprise.
The so-called surprise that she was taken to the suburbs, so a pirate ship on the big summer in this little boat on the river was to the night.
Of course, she admits that it took the Western point of David's mind, at least, so now she is sitting in an ancient landscape of the boats on, listening to the sounds came faintly stern, quality of food and wine, to look cool and bright moon shining into the surrounding water, sparkling waves glow. In fact, if not around too desolate, too arrogant, then the mosquito, called a scene is pretty romantic.
"Yes ah yes ah, you see it near the woods, there is a stone, is not that you said the Chinese 'moon pine photos, rock springs high' it?" David's voice reveals himself in the excitement.
"Oh, really who do not three days, with admiration, ah, that the surrounding environment, and you can see that this mood, great!" Woods looked around the ship a piece of black paint smeared, [url=" http://www.amazemalls.com ] wholesale prada handbags [/url]
could not help but laugh at one.
"Actually, that's OK, I was asked to you like this poem, specially took half a day back down." David, when the woods are really praise him instead, he embarrassed them, presumably to prove that he is indeed cramming, he even plans to the entire song "Mountain Autumn Dusk" back out "to the table clean", and "empty-san after the rain, the weather late to fall. moon pine photos, rock springs high ..."
"Well, well." Woods did not go, busy interrupting him, "I know you powerful, do not pull the text up. To, try this salmon, I have not thought of in this wilderness can eat such a good taste of sashimi. "
"That is natural." David's pride was palpable, "said the master of my food brought in specially from Japan, craft beautifully!"
"Oh?" David, [url=" http://www.bizonmall.com ] coach handbags outlet [/url]
look beyond the woods, behind the bamboo curtain busy pegged that figure, was secretly wondering: either go back and talk to him, see if I can dig these free workshops to master.
David did not notice her go God, the arm holding the woods, wink and said:
"But you have not found the woods, lake of the moon that look better than the sky ..."
Looked at the lake, the woods, is planning to meet with to say something, to see David fed to a red rope, pretending to be mysterious to say: "Do you want to finish the lake of the moon?"
"Fishing for the moon?" Woods ridiculous, this French guy also romantic too far right, elusive, where is can Laode out?
"I'm not a monkey, what fishing moon ah." That being said, the woods, or could not bear to sweep David Hing, Flanagan casually casts a rope.
Red string of the end of the line submerged in water, the woods do not charge any effort to salvage a moon[url=" http://www.savemalls.com/ ] Cheap coach handbags [/url]" shaped crystal box, full of doubts to erase the stains on the lid, the crystal through the crystal lid, the box clearly see the woods which quietly erected a dazzling diamond ring, rough estimate, the diamond should not be less than three carats.
"How, I said the moon it can be purely monetary." David's eyes shining, taking advantage of the woods in a daze the moment, he took the ring from her hands, one knee, his head affectionately against the woods said:
"Marry me, the woods."
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years
[Hibernate-JIRA] Created: (HHH-6905) Getting invalid ID on cascade (using @DiscriminatorColumn)
by Rogério Lino (JIRA)
Getting invalid ID on cascade (using @DiscriminatorColumn)
----------------------------------------------------------
Key: HHH-6905
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6905
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.CR4
Environment: JPA 2 / Hibernate 4.0.0.CR4, Postgres 9, Linux (Ubuntu 11.10)
Reporter: Rogério Lino
Priority: Minor
When try to persist a entity with a list (@OneToMany), the id returned to save in cascade is the value of discriminator column (int).
Ex:
@Entity
@Table(name = "person")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.INTEGER)
class Person extends MappedSuperClassWithId {
}
----
@Entity
@DiscriminatorValue("9999")
class Employee extends Person {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "employee")
private List<Phone> phones;
}
----
Employee employee = new Employee();
// employee setters
Phone phone = new Phone();
// employee setters
employee.getPhones().add(phone);
entityManager.persist(employee);
// throw org.hibernate.exception.ConstraintViolationException
// ERROR: insert or update on table "phone" violates foreign key constraint "..."
// Detail: Key (id_employee)=(9999) is not present in table "person".
----
The column order in the table person (generated by hibernate.hbm2ddl.auto) is "type" and "id". When I change to "id" and "type", works fine.
For some reason Hibernate is getting as last id the value of first table column.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years
[Hibernate-JIRA] Created: (HHH-6904) Use LIMIT X, Y for list.subList() on immutable extra-lazy collections with @OrderBy
by Bogdan Butnaru (JIRA)
Use LIMIT X, Y for list.subList() on immutable extra-lazy collections with @OrderBy
-----------------------------------------------------------------------------------
Key: HHH-6904
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6904
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.6.5
Reporter: Bogdan Butnaru
Priority: Minor
As far as I know, an entity list marked with {{(a)LazyCollection(LazyCollectionOption.EXTRA)}} will still load the entire collection unless {{javax.persistence.@OrderColumn}} is used. The trouble is that @OrderColumn must be an index.
It would be nice if Hibernate took advantage of {{org.hibernate.annotations.OrderBy}} and the various paging features of databases to do the same thing. Consider the configuration below:
{code}
@Entity
class A {
...
}
@Entity
class B {
@Immutable
@OneToMany
@LazyCollection(LazyCollectionOption.EXTRA)
@JoinTable(name = "a_of_b")
@OrderBy(clause = "timestamp DESC")
List<A> listOfA;
}
List<A> firstA(B b, int max){
List<A> list = b.listOfA();
return list.subList(0, Math.min(list.size(), max));
}
{code}
In this case, Hibernate loads the entire list, even if max is much smaller. It generates something like:
{code}
SELECT a.* FROM a JOIN a_of_b j ON a.id = j.a_id
WHERE j.id = ? ORDER BY timestamp DESC
{code}
when instead it could do:
{code}
SELECT a.* FROM a JOIN a_of_b j ON a.id = j.a_id
WHERE j.id = ? ORDER BY timestamp DESC LIMIT ?, ?
{code}
with the {{LIMIT}} set to whatever was passed to {{subList}}. (Except that if it already loaded some overlapping slices of the list before it could skip those parts.)
I haven't thought a lot about how updates should be handled, but at least for the case of immutable collections it should work nicely. I haven't worked much with cursors, but AFAIK the same thing could be done for databases that support them.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years
[Hibernate-JIRA] Created: (HHH-6898) Hibernate generates double constraints for FK?
by Henrik Korsbæk (JIRA)
Hibernate generates double constraints for FK?
-----------------------------------------------
Key: HHH-6898
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6898
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.8
Environment: Progress, java 7, win 7, intellij 11.
Reporter: Henrik Korsbæk
Priority: Minor
When using naming of relations (@org.hibernate.annotations.ForeignKey(name = "undermyndighed_FK")) Hibernates generates both a constraint using the name AND an identical constraint using a generated name:
alter table Myndighedsrelationer add constraint FK382528159E2E9E11 foreign key (undermyndighedId) references Myndighed;
alter table Myndighedsrelationer add constraint undermyndighed_FK foreign key (undermyndighedId) references Myndighed;
and
alter table Myndighedsrelationer add constraint FK38252815C1F7CE95 foreign key (overmyndighedId) references Myndighed;
alter table Myndighedsrelationer add constraint overmyndighed_FK foreign key (overmyndighedId) references Myndighed;
It should only generate:
alter table Myndighedsrelationer add constraint undermyndighed_FK foreign key (undermyndighedId) references Myndighed;
alter table Myndighedsrelationer add constraint overmyndighed_FK foreign key (overmyndighedId) references Myndighed;
Classes:
_________________________________________________________________________________________________________________________
package dk.ttt.rrr.model.rrr.myndighed;
@dk.team.foundation.bean.mdsd.BaseClazz(extensionClazz = dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer.class)
@javax.persistence.MappedSuperclass
abstract public class AbstractMyndighedsrelationer extends dk.team.mddexample.model.AbstractEntity {
private static final long serialVersionUID = 1404123320L;
public static dk.team.foundation.bean.mdsd.runtime.RuntimeMetaClazz metaType =
(dk.team.foundation.bean.mdsd.runtime.RuntimeMetaClazz) dk.team.mddexample.meta.RuntimeMetaModelFactory.getMetaModel()
.findById("ID_4F134AAD_7D6B_4a0d_B367_247AC5286AFA");
@javax.persistence.ManyToOne(cascade = {
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
, fetch = javax.persistence.FetchType.LAZY)
@javax.persistence.JoinColumn(nullable = false, name = "undermyndighedId")
@org.hibernate.annotations.ForeignKey(name = "undermyndighed_FK")
private dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed undermyndighed;
@javax.persistence.Enumerated(javax.persistence.EnumType.STRING)
@javax.persistence.Column(name = "type_", nullable = false)
private dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationstype type;
@javax.persistence.ManyToOne(cascade = {
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
, fetch = javax.persistence.FetchType.LAZY)
@javax.persistence.JoinColumn(nullable = false, name = "overmyndighedId")
@org.hibernate.annotations.ForeignKey(name = "overmyndighed_FK")
private dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed overmyndighed;
public dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed getUndermyndighed() {
if (undermyndighed instanceof org.hibernate.proxy.HibernateProxy) {
undermyndighed = (dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed) ((org.hibernate.impl.SessionImpl) ((org.hibernate.proxy.HibernateProxy) undermyndighed)
.getHibernateLazyInitializer()
.getSession()).getPersistenceContext()
.unproxyAndReassociate(undermyndighed);
}
return undermyndighed;
}
@java.lang.SuppressWarnings({"serial",
"unchecked",
"rawtypes"
})
public void setUndermyndighed(
dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed parameter) {
new dk.team.foundation.bean.bidirectional.ManyToOneWrapper<dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed, dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer>((dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer) this) {
@Override
protected void addManySideObjectToOneSideCollection(
dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed oneSide,
dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer manySide) {
((dk.team.foundation.bean.WrappedSet<dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer>) oneSide
.getOvermyndighedCollection()).getWrappedCollection()
.add(manySide);
}
@Override
protected void removeManySideObjectFromOneSideCollection(
dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed oneSide,
dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer manySide) {
((dk.team.foundation.bean.WrappedSet<dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer>) oneSide
.getOvermyndighedCollection()).getWrappedCollection()
.remove(manySide);
}
@Override
protected dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed getOneSideObjectInManySideObject(
dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer manySide) {
return ((dk.ttt.rrr.model.rrr.myndighed.AbstractMyndighedsrelationer) manySide).undermyndighed;
}
@Override
protected void setOneSideObjectInManySideObject(
dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer manySide,
dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed oneSide) {
((dk.ttt.rrr.model.rrr.myndighed.AbstractMyndighedsrelationer) manySide).undermyndighed = oneSide;
}
}.updateOneSideObject(parameter);
}
public dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationstype getType() {
return type;
}
public void setType(
dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationstype parameter) {
this.type = parameter;
}
public dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed getOvermyndighed() {
if (overmyndighed instanceof org.hibernate.proxy.HibernateProxy) {
overmyndighed = (dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed) ((org.hibernate.impl.SessionImpl) ((org.hibernate.proxy.HibernateProxy) overmyndighed)
.getHibernateLazyInitializer()
.getSession()).getPersistenceContext()
.unproxyAndReassociate(overmyndighed);
}
return overmyndighed;
}
@java.lang.SuppressWarnings({"serial",
"unchecked",
"rawtypes"
})
public void setOvermyndighed(
dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed parameter) {
new dk.team.foundation.bean.bidirectional.ManyToOneWrapper<dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed, dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer>((dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer) this) {
@Override
protected void addManySideObjectToOneSideCollection(
dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed oneSide,
dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer manySide) {
((dk.team.foundation.bean.WrappedSet<dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer>) oneSide
.getUndermyndighedCollection()).getWrappedCollection()
.add(manySide);
}
@Override
protected void removeManySideObjectFromOneSideCollection(
dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed oneSide,
dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer manySide) {
((dk.team.foundation.bean.WrappedSet<dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer>) oneSide
.getUndermyndighedCollection()).getWrappedCollection()
.remove(manySide);
}
@Override
protected dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed getOneSideObjectInManySideObject(
dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer manySide) {
return ((dk.ttt.rrr.model.rrr.myndighed.AbstractMyndighedsrelationer) manySide).overmyndighed;
}
@Override
protected void setOneSideObjectInManySideObject(
dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer manySide,
dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed oneSide) {
((dk.ttt.rrr.model.rrr.myndighed.AbstractMyndighedsrelationer) manySide).overmyndighed = oneSide;
}
}.updateOneSideObject(parameter);
}
public dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer withUndermyndighed(
dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed undermyndighed) {
setUndermyndighed(undermyndighed);
return (dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer) this;
}
public dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer withType(
dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationstype type) {
setType(type);
return (dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer) this;
}
public dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer withOvermyndighed(
dk.ttt.rrr.model.rrr.myndighed.IndlandskMyndighed overmyndighed) {
setOvermyndighed(overmyndighed);
return (dk.ttt.rrr.model.rrr.myndighed.Myndighedsrelationer) this;
}
public dk.team.foundation.bean.mdsd.runtime.RuntimeMetaClazz getMetaType() {
return metaType;
}
}
__________________________________________________________________________________________________________________________
package dk.ttt.rrr.model.rrr.myndighed;
@dk.team.foundation.bean.mdsd.BaseClazz(extensionClazz = dk.ttt.rrr.model.rrr.myndighed.Myndighed.class)
@javax.persistence.Entity
@javax.persistence.Inheritance(strategy = javax.persistence.InheritanceType.SINGLE_TABLE)
@javax.persistence.DiscriminatorColumn(name = "DTYPE", discriminatorType = javax.persistence.DiscriminatorType.STRING, length = 255)
@org.hibernate.annotations.DiscriminatorOptions(force = true)
@javax.persistence.Table(name = "Myndighed")
abstract public class AbstractMyndighed extends dk.team.mddexample.model.AbstractEntity {
private static final long serialVersionUID = 2811393302L;
public static dk.team.foundation.bean.mdsd.runtime.RuntimeMetaClazz metaType =
(dk.team.foundation.bean.mdsd.runtime.RuntimeMetaClazz) dk.team.mddexample.meta.RuntimeMetaModelFactory.getMetaModel()
.findById("ID_421765D5_5F61_4a14_8C2E_F8F8787A9B78");
@javax.persistence.Basic
@javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
@javax.persistence.Column(name = "ikraefttraedelsesdato", nullable = false)
private java.util.Date ikraefttraedelsesdato;
@javax.persistence.Basic
@javax.persistence.Column(name = "kode", nullable = false)
private int kode;
@javax.persistence.Basic
@javax.persistence.Column(name = "navn", nullable = false)
private String navn;
@javax.persistence.Basic(optional = true)
@javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
@javax.persistence.Column(name = "ophoersdato")
private java.util.Date ophoersdato;
@javax.persistence.Basic
@javax.persistence.Column(name = "sekundaer", nullable = false)
private boolean sekundaer;
@javax.persistence.OneToMany(cascade = {
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
, targetEntity = dk.ttt.rrr.model.rrr.sag.SagsRolle.class, mappedBy = "myndighed", fetch = javax.persistence.FetchType.LAZY)
private java.util.Set<dk.ttt.rrr.model.rrr.sag.SagsRolle> rolleCollection = new java.util.HashSet<dk.ttt.rrr.model.rrr.sag.SagsRolle>();
public java.util.Date getIkraefttraedelsesdato() {
return ikraefttraedelsesdato;
}
public void setIkraefttraedelsesdato(java.util.Date parameter) {
this.ikraefttraedelsesdato = parameter;
}
public int getKode() {
return kode;
}
public void setKode(int parameter) {
this.kode = parameter;
}
public String getNavn() {
return navn;
}
public void setNavn(String parameter) {
this.navn = parameter;
}
public java.util.Date getOphoersdato() {
return ophoersdato;
}
public void setOphoersdato(java.util.Date parameter) {
this.ophoersdato = parameter;
}
public boolean isSekundaer() {
return sekundaer;
}
public void setSekundaer(boolean parameter) {
this.sekundaer = parameter;
}
@java.lang.SuppressWarnings({"serial",
"unchecked",
"rawtypes"
})
public java.util.Set<dk.ttt.rrr.model.rrr.sag.SagsRolle> getRolleCollection() {
return new dk.team.foundation.bean.bidirectional.OneToManySetWrapper<dk.ttt.rrr.model.rrr.myndighed.Myndighed, dk.ttt.rrr.model.rrr.sag.SagsRolle>((dk.ttt.rrr.model.rrr.myndighed.Myndighed) this,
rolleCollection) {
@Override
protected dk.ttt.rrr.model.rrr.myndighed.Myndighed getOneSideObjectInManySideObject(
dk.ttt.rrr.model.rrr.sag.SagsRolle manySideObject) {
return manySideObject.getMyndighed();
}
@Override
protected void setOneSideObjectInManySideObject(
dk.ttt.rrr.model.rrr.sag.SagsRolle manySideObject,
dk.ttt.rrr.model.rrr.myndighed.Myndighed oneSideObject) {
manySideObject.setMyndighed(oneSideObject);
}
};
}
public dk.ttt.rrr.model.rrr.myndighed.Myndighed withIkraefttraedelsesdato(
java.util.Date ikraefttraedelsesdato) {
setIkraefttraedelsesdato(ikraefttraedelsesdato);
return (dk.ttt.rrr.model.rrr.myndighed.Myndighed) this;
}
public dk.ttt.rrr.model.rrr.myndighed.Myndighed withKode(int kode) {
setKode(kode);
return (dk.ttt.rrr.model.rrr.myndighed.Myndighed) this;
}
public dk.ttt.rrr.model.rrr.myndighed.Myndighed withNavn(String navn) {
setNavn(navn);
return (dk.ttt.rrr.model.rrr.myndighed.Myndighed) this;
}
public dk.ttt.rrr.model.rrr.myndighed.Myndighed withOphoersdato(
java.util.Date ophoersdato) {
setOphoersdato(ophoersdato);
return (dk.ttt.rrr.model.rrr.myndighed.Myndighed) this;
}
public dk.ttt.rrr.model.rrr.myndighed.Myndighed withSekundaer(
boolean sekundaer) {
setSekundaer(sekundaer);
return (dk.ttt.rrr.model.rrr.myndighed.Myndighed) this;
}
public dk.ttt.rrr.model.rrr.myndighed.Myndighed addToRolleCollection(
dk.ttt.rrr.model.rrr.sag.SagsRolle... values) {
getRolleCollection().addAll(java.util.Arrays.asList(values));
return (dk.ttt.rrr.model.rrr.myndighed.Myndighed) this;
}
public dk.team.foundation.bean.mdsd.runtime.RuntimeMetaClazz getMetaType() {
return metaType;
}
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years