Results 1 to 2 of 2
  1. #1
    kattoha is offline Member
    Join Date
    Apr 2014
    Rep Power

    Default Hibernate and @PrimaryKeyJoinColumn and its strange behaviour

    Hello, Community. I have a question. I have two entities:
    Java Code:
    @Table(name = "articles_all")
    public class Article extends BaseEntity {
        @Column(nullable = false, unique = true, length = 11)
        private int id;
        @Column(nullable=false, length=255)
        private String title;
        private byte[] content;
        private UsersEntity author;
        @OneToOne(mappedBy="article", cascade=CascadeType.ALL)
        private Archive archive;
    and Archive:
    Java Code:
    public class Archive {
        @GenericGenerator(name="generator", strategy="foreign", parameters=@Parameter(name="property", value = "article"))
        private int articleId;
        private Article article;
    When I run application with this configurations, all tables in database are create automatically, so I have 'archive' table with foreign primary key, but when I try to add one more field into Archive entity (any field), tables didn't create, but works with manually created table (but my goal - automation). (All actions were used on database with dropped tables) .
    What does it mean? Is it a bug or it is normal behaviour?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Hibernate and @PrimaryKeyJoinColumn and its strange behaviour

    Moved from New to Java to Hibernate.

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. very Strange behaviour !!
    By selimzz in forum Advanced Java
    Replies: 12
    Last Post: 01-06-2013, 12:35 PM
  2. Strange JFrame behaviour
    By javaExprt in forum New To Java
    Replies: 5
    Last Post: 12-24-2012, 04:20 AM
  3. Strange behaviour
    By imadabh in forum Threads and Synchronization
    Replies: 1
    Last Post: 05-11-2011, 04:31 PM
  4. Strange JVM behaviour
    By pjpr in forum Advanced Java
    Replies: 13
    Last Post: 01-03-2011, 08:39 PM
  5. AffinedTransform strange behaviour
    By Echilon in forum AWT / Swing
    Replies: 3
    Last Post: 12-11-2008, 10:58 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts