Coders Campus Podcast

Coders Campus Podcast

By Trevor PageEducationHow ToCourses
Download on the App Store

Coders Campus Podcast episodes

  • EP 62: Introduction to HTML

    I’m so ridiculously excited to be introducing a whole new aspect of programming. Over the next few months I will be posting new articles on the topics of HTML, Javascript and jQuery. These are all technologies that you can use to create your very own interactive website. The really cool thing about building websites, is that you can leverage your existing knowledge of Java to create ever MORE powerful websites. But let’s not get ahead of ourselves, for now we’ll focus first on HTML, then we’ll move into Javascript/jQuery. But enough big picture talk, let’s get into our introduction to html shall we?

     

    An Introduction to HTML…

    HTML stands for HyperText Markup Language, and all this really means is that HTML is not a programming language, but rather just a set of rules for structuring your text. This means that if you type out certain words in a particular way, you can create a website! Piece of cake right? For the most part, YES, it is a piece of cake

    ...Read more here...

    35 min
  • HTML, CSS and JavaScript - Oh My!

    The presentation layer is one of the three main layers in object-oriented programming.

    The three main layers include:

    • Presentation Layer
    • Business Layer
    • Data Layer
    • Now, these three layers are typically related to enterprise web applications. It’s a design pattern used to help separate your code out in three distinct areas that (if need be) can easily be switched out with another programming language or technology.

      So if you keep all of your presentation layer code in one area of your application, switching presentation layer technologies shouldn’t be too difficult.

      Same rules apply to the business and data layers. If you separated your code out properly, switching databases shouldn’t be too big of an issue.

      Having said that, we’ll be focusing on the presentation layer.

      The four big players (in terms of technology) in the presentation layer are as follows:

      (Keep Reading)

      41 min
    • Hibernate Group By

      In our last Hibernate lesson, you learned how to fix duplicate data from hibernate queries.

      In this lesson we’re going to focus on some of theaggregate functions that can be used with Hibernate, and of course that means diving into theGroup By clause.

      What’s important to note is that Hibernate doesn’t ever refer to it as group by, instead they use the term projections.

      So, armed with this knowledge, let’s jump into the lesson!

      Grouping Data with Hibernate

      In our examples, I’m going to show you how to create a query with hibernate that will group your data in some manner.

      When we build our query, we will be focusing on using Hibernate’s Criteria queries, which allows for a nice way to build queries without having to know any SQL.

      First, let’s start off with an example that we will build on.

      ...continue reading.

      44 min
    • Fixing Duplicate Data from Hibernate Queries
      How to Fix Duplicate Data from Hibernate Queries

      This problem was the bane of my existence when I first started using Hibernate because I had no idea where the problem was coming from.

      If you’re executing a query and finding that you have a bunch of duplicate records and haven’t a clue why, then you’re in the right place.

      You see the problem is typically caused by having left joins (or optional joins) in your objects. When you have a base object, like say User and it joins to another table/object in an optional One-to-Many or optional Many-to-Many format, then you may get duplicates.

      Consider this scenario… A User objects joins to the LoginHistory object, which keeps track of all the times a particularUser has logged into the system. And let’s say our user has logged in many times. You’ll have a situation where you have many records in the LoginHistory table.

      So what happens when you run a query that joins to the LoginHistory table? Well it will return as many rows as there are entries for that User in the LoginHistory table.

      So because of this, Hibernate doesn’t massage the data for you, it just returns exactly what it got from the database. The ball is in your court to tell Hibernate what to do with records it has retrieved.

      There are two solutions to this problem:

      1. Declare your joining object as a Set
      2. Make use of Distinct Root Entity Results Transformer
      3. Click Here to Keep Reading

        32 min
      4. Hibernate Persistence Life Cycle

        Now it’s time to dive into the nitty gritty of Hibernate’s mysterious inner workings.

        I’m by no means an expert in Hibernate, but I do use it almost every day for my own projects, so I do know a thing or two about how it works.

        One topic that had me scratching my head for ages was the Hibernate life cycle. What I mean by the life cycle is the way Hibernate interacts with Java objects at certain points in the existence of said Java objects.

        Let’s start from the beginning…

        What the heck is a Hibernate Life Cycle?

        You see, Hibernate is picky about your Java objects. Hibernate prefers your objects to be in a certain “state”, known as the persistent state… this persistent state is one of four different states that exist inside of the hibernate persistence life cycle.

        Once you have a firm grasp of the different states that an object can be in (as it pertains to Hibernate) you’ll be well on your way to mastering the Hibernate framework.

        So let’s get this Hibernate persistence life cycle lesson started shall we?

        Continue reading via: http://howtoprogramwithjava.com/session58

        43 min
      5. Fetch Type Lazy Vs Eager
        What the heck is a Fetch Type?

        Great question! Hibernate is a very handy framework for removing your need to fully understand SQL, but it will force you to understand things such as joins.

        Joining two tables in SQL is the foundation of a relational database, as joins allow you to actually define relationships between tables (objects).

        Having said that, relationships are important to understand when talking about fetch types in Hibernate. This is the case because whenever you define a relationship in Hibernate, you’ll also need to define the fetch type. The fetch type essentially decides whether or not to load all of the relationships of a particular object/table as soon as the object/table is initially fetched.

        For more information please see the show notes via http://howtoprogramwithjava.com/session57

        30 min
      6. Hibernate @ManyToMany Unidirectional and Bidirectional
        Hibernate @ManyToMany Unidirectional

        The Many-to-Many relationship can be best described by example.

        The example we’re going to use is that of the relationship between an Author and a Book.

        Authors publish Books, and Books have Authors. Any one Author can publish many Books, and any one Book can be published by many Authors, so this is why it is a many to many relationship.

        Other examples of the many to many relationship are Students to Courses and Employees to Projects.

        Let’s take a look at how the unidirectional many-to-many relationship is created using Hibernate... for more info please visit http://howtoprogramwithjava.com/session56

        53 min
      7. Hibernate @OneToOne Unidirectional / Bidirectional
        One-to-One Unidirectional Relationship

        Since you’ve already learned about the ins and outs of how unidirectional one-to-many and bidirectional one-to-many relationships work, it’s time to learn about the One-to-One relationships.

        We will start things off with the unidirectional One-to-One relationship and how it’s set up in Hibernate.

        First thing is first, you need to understand how a One-to-One relationship is actually set up in a database. Once you understand that the child table declares the parent’s primary key as the child’s primary key, then we can get moving with the Hibernate stuff!

        For this example, we are going to use the One-to-One relationship between an Employee and their Address. TheAddress table will be set up as follows:

        For more information, please read the show notes via http://howtoprogramwithjava.com/session55

        37 min
      8. Hibernate @OneToMany Bidirectional Relationship

        Since we’ve already learned about the unidirectional @ManyToOne relationship, we can now move on to talking about what a bidirectional relationship is like, when using Hibernate. The term “bidirectional” literally means “functioning in two directions”, which is the concept that we will apply in our relationships between two Java objects. When we have a bidirectional relationship between objects, it means that we are able to access Object A from Object B, and Object B from Object A. We can apply this logic to our real world coding example that we saw in the last post. The example we will use is the relationship between an Employer and an Employee. Previously, we only defined a unidirectional relationship, so we could only access the Employer from the Employee object and not vice-versa. Now let’s take a look at how to transform our existing unidirectional relationship into a bidirectional one.

        35 min
      9. Mapping Relationships with Hibernate

        In the past we have learned about database relationships, specifically the One-to-Many as well as the Many-to-Many and One-to-One and that was all good, great and grand…

        But now I want to talk about how to create those same relationships inside of Hibernate.

        Specifically, I want to focus on the One-to-Many relationship in Hibernate and how we go about mapping it out in our Java objects.

        But before we do, a word on unidirectional and bidirectional relationships.

        Unidirectional vs Bidirectional

        In Hibernate, it’s possible to map all three relationships that are available in a standard database, these include:

        • One-to-One
        • One-to-Many
        • Many-to-Many
        • But what Hibernate also includes is the ability to make EACH of those relationships either unidirectional or bidirectional.

          This means that we can have a unidirectional One-to-One and a bidirectional One-to-One mapping, as well as a unidirectional One-to-Many and a bidirectional One-to-Many, as well as a unidirectional Many-to-Many and a bidirectional Many-to-Many relationship.

          That’s a lot of relationships!

          So what exactly are unidirectional and bidirectional relationships?

          Learn more on the show notes page via http://howtoprogramwithjava.com/session53

          56 min

        About Coders Campus Podcast

        From the publisher's feed

        Learn how to program using the Java programming language. This podcast will teach you step by step how to use the Java programming language to create your own applications or web applications! These…